From 364d9375315be7978052ce4883a03340e46eedfe Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Wed, 18 Dec 2024 23:01:22 +0200 Subject: [PATCH 1/8] Separate main css from build script --- scripts/md2html/main.css | 73 ++++++++++++++++++++++++++++++++++++++ scripts/md2html/md2html.js | 15 +------- 2 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 scripts/md2html/main.css diff --git a/scripts/md2html/main.css b/scripts/md2html/main.css new file mode 100644 index 0000000000..ba4f15bbb9 --- /dev/null +++ b/scripts/md2html/main.css @@ -0,0 +1,73 @@ +#respec-ui { + visibility: hidden; +} + +#title { + color: #578000; +} + +#subtitle { + color: #578000; +} + +.dt-published { + color: #578000; +} + +.dt-published::before { + content: "Published "; +} + +h1, h2, h3, h4, h5, h6 { + color: #578000; + font-weight: normal; + font-style: normal; +} + +a[href] { + color: #45512c; +} + +body:not(.toc-inline) #toc h2 { + color: #45512c; +} + +table { + display: block; + width: 100%; + overflow: auto; +} + +table th { + font-weight: 600; +} + +table th, table td { + padding: 6px 13px; + border: 1px solid #dfe2e5; +} + +table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; +} + +table tr:nth-child(2n) { + background-color: #f6f8fa; +} + +pre { + background-color: #f6f8fa !important; +} + +code { + color: #c83500 +} + +th code { + color: inherit +} + +a.bibref { + text-decoration: underline; +} \ No newline at end of file diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index fd3ec78f69..eccc2259cb 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -137,20 +137,7 @@ function preface(title,options) { catch (ex) {} preface += ''; preface += ''; preface += `

${title.split('|')[0]}

`; From 3491e3b2b47609e145ec7bd686fd523409e72331 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Wed, 18 Dec 2024 23:05:45 +0200 Subject: [PATCH 2/8] Add styling for dark mode --- scripts/md2html/main.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/md2html/main.css b/scripts/md2html/main.css index ba4f15bbb9..302e047241 100644 --- a/scripts/md2html/main.css +++ b/scripts/md2html/main.css @@ -70,4 +70,13 @@ th code { a.bibref { text-decoration: underline; +} + +@media (prefers-color-scheme: dark) { + pre, + table tr:nth-child(2n), + table tr { + background-color: #1e1e1e !important; + color: #dcdcdc; + } } \ No newline at end of file From b85311eb00c04d06b288ceb7915250df91fea370 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Wed, 18 Dec 2024 23:12:41 +0200 Subject: [PATCH 3/8] Use the background color of the page --- scripts/md2html/main.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/md2html/main.css b/scripts/md2html/main.css index 302e047241..073ef7d89e 100644 --- a/scripts/md2html/main.css +++ b/scripts/md2html/main.css @@ -79,4 +79,8 @@ a.bibref { background-color: #1e1e1e !important; color: #dcdcdc; } + + img { + background: transparent; + } } \ No newline at end of file From d8ff02e552d156cb9cf2e627cafe7ab66b7af81b Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Wed, 18 Dec 2024 23:34:23 +0200 Subject: [PATCH 4/8] Change logo when on dark mode --- scripts/md2html/main.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/md2html/main.css b/scripts/md2html/main.css index 073ef7d89e..b120b46793 100644 --- a/scripts/md2html/main.css +++ b/scripts/md2html/main.css @@ -83,4 +83,17 @@ a.bibref { img { background: transparent; } + + .logo img { + display: none; + } + + .logo::before { + content: ""; + display: inline-block; + height: 48px; + width: 200px; + background: url("https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/refs/heads/main/graphics/bitmap/OpenAPI_Logo_White.png") no-repeat center / contain; + vertical-align: middle; + } } \ No newline at end of file From a9996c0098d3620def6b79fca3f33e3ae05ba5d4 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Wed, 18 Dec 2024 23:40:31 +0200 Subject: [PATCH 5/8] Add official dark mode stylesheet --- scripts/md2html/md2html.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index eccc2259cb..565105d122 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -149,6 +149,7 @@ function preface(title,options) { preface += '

Status of This Document

'; preface += 'The source-of-truth for this specification is the HTML file referenced above as This version.'; preface += ''; + preface += ''; return preface; } From b0e25856fae5eeb063388714bd3e816d6bf5dfc6 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Thu, 19 Dec 2024 00:21:06 +0200 Subject: [PATCH 6/8] Deploy to a different branch --- .github/workflows/respec.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/respec.yaml b/.github/workflows/respec.yaml index 0b62909990..9274dd4bc8 100644 --- a/.github/workflows/respec.yaml +++ b/.github/workflows/respec.yaml @@ -5,7 +5,7 @@ name: respec # # This workflow updates the respec 'pretty' rendered versions of the spec -# on the gh-pages branch when the corresponding markdown files change. +# on the pages branch when the corresponding markdown files change. # # run this on push to main @@ -32,9 +32,9 @@ jobs: - name: Install dependencies run: npm ci - - uses: actions/checkout@v4 # checkout gh-pages branch + - uses: actions/checkout@v4 # checkout pages branch with: - ref: gh-pages + ref: pages path: deploy - name: run main script @@ -45,7 +45,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} branch: update-respec-version - base: gh-pages + base: pages delete-branch: true path: deploy labels: Housekeeping From 55878197225402fce793acca2ae92e8e4da24782 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Thu, 19 Dec 2024 07:57:08 +0200 Subject: [PATCH 7/8] Remove reviewers --- .github/workflows/respec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/respec.yaml b/.github/workflows/respec.yaml index 9274dd4bc8..ffe9b416cd 100644 --- a/.github/workflows/respec.yaml +++ b/.github/workflows/respec.yaml @@ -49,7 +49,6 @@ jobs: delete-branch: true path: deploy labels: Housekeeping - reviewers: darrelmiller,webron,earth2marsh,webron,lornajane,mikekistler,miqui,ralfhandl,handrews,karenetheridge title: Update ReSpec-rendered specification versions commit-message: Update ReSpec-rendered specification versions signoff: true From cd10019273ac2bcfa2bd53cd9ee1bc46d5dc5ca0 Mon Sep 17 00:00:00 2001 From: Bellangelo Date: Thu, 19 Dec 2024 08:46:52 +0200 Subject: [PATCH 8/8] Fix dark mode --- scripts/md2html/main.css | 47 +++++++++++++++++++++++++++++++------- scripts/md2html/md2html.js | 2 +- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/scripts/md2html/main.css b/scripts/md2html/main.css index b120b46793..b9017acc4c 100644 --- a/scripts/md2html/main.css +++ b/scripts/md2html/main.css @@ -73,27 +73,58 @@ a.bibref { } @media (prefers-color-scheme: dark) { - pre, - table tr:nth-child(2n), - table tr { + body.darkmode { + --toclink-underline: #6a9000; + --toclink-visited-underline: #fff; + } + + body.darkmode a, + body.darkmode .tocxref, + body.darkmode .u-url { + color: #6a9000; + } + + body.darkmode code { + color: #e66c33; + } + + body.darkmode:not(.toc-inline) #toc h2, + body.darkmode h1, + body.darkmode h2, + body.darkmode h3, + body.darkmode h4, + body.darkmode h5, + body.darkmode h6, + body.darkmode #title, + body.darkmode #subtitle, + body.darkmode .toc-inline, + body.darkmode .dt-published { + color: #7bb01c; + } + + body.darkmode pre, + body.darkmode table tr:nth-child(2n), + body.darkmode table tr { background-color: #1e1e1e !important; color: #dcdcdc; } - img { + body.darkmode img { background: transparent; } - .logo img { + body.darkmode .logo img { display: none; } - .logo::before { + body.darkmode .logo::before { content: ""; display: inline-block; height: 48px; - width: 200px; - background: url("https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/refs/heads/main/graphics/bitmap/OpenAPI_Logo_White.png") no-repeat center / contain; + width: 175px; + background: url("https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/refs/heads/main/graphics/bitmap/OpenAPI_Logo_Pantone.png") no-repeat center / contain; vertical-align: middle; } +} + } \ No newline at end of file diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 565105d122..f2ae056919 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -129,6 +129,7 @@ function preface(title,options) { preface += ''; // ReSpec + preface += ''; preface += ''; preface += ``; try { @@ -149,7 +150,6 @@ function preface(title,options) { preface += '

Status of This Document

'; preface += 'The source-of-truth for this specification is the HTML file referenced above as This version.'; preface += ''; - preface += ''; return preface; }