diff --git a/static/css/blog/post.css b/static/css/blog/post.css index 67ac417..34f1fc1 100644 --- a/static/css/blog/post.css +++ b/static/css/blog/post.css @@ -1,21 +1,13 @@ +@import "markdown.css"; + @media (prefers-color-scheme: light) { :root { - --code-font-color: #333333; - --code-bg-color: #eeeeee; - --quote-border-color: #9852fa; - --quote-bg-color: #d8d6d6; - --separator-color: #cccccc; --tag-bg-color: #d2e0f0; } } @media (prefers-color-scheme: dark) { :root { - --code-font-color: #eeeeee; - --code-bg-color: #333333; - --quote-border-color: #bd93f9; - --quote-bg-color: #273341; - --separator-color: #414558; --tag-bg-color: #242e38; } } @@ -24,11 +16,6 @@ --max-width: 750px; } -/* Page */ -html { - scroll-behavior: smooth; -} - body { max-width: var(--max-width); margin: auto; @@ -70,49 +57,8 @@ main { max-width: 100%; } -/* Anchors */ -:is(h1, h2, h3, h4, h5, h6):hover a.anchor::before { - visibility: visible; -} - -a.anchor::before { - content: "#"; - visibility: hidden; - padding-right: 0.1em; -} - -a.anchor { - text-decoration: none; - vertical-align: baseline; -} - -/* Links in headers */ -:is(h1, h2, h3, h4, h5, h6) a { - font-size: inherit; -} - -/* Separators */ -hr { - border: 0; - height: 1px; - background: var(--separator-color); -} - -/* Quotes */ -blockquote { - margin: 1em 0; - padding: 0.1em 10px; - border-left: 6px solid; - border-color: var(--quote-border-color); - background: var(--quote-bg-color); - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; -} - /* Images */ img { - display: block; - margin: auto; max-width: var(--max-width); } @@ -122,115 +68,6 @@ code { font-family: monospace; } -/* Little snippet of code (not blocks) */ -kbd, -code:not(.hljs):not(:has(svg)) { - background: var(--code-bg-color); - border-radius: 3px; - color: var(--code-font-color); - box-shadow: 0 1px 1px black; - font-size: calc(var(--font-size) * 0.8); - padding: 2px 4px; - vertical-align: 1.5px; -} - -/* Code blocks */ -.hljs { - border-radius: 5px; -} - -.hljs::-webkit-scrollbar { - width: 7px; - height: 9px; - background: var(--background); -} - -.hljs::-webkit-scrollbar-thumb { - background-color: var(--font-color); - border-radius: 10px; -} - -/* Marge for numbers */ -.hljs-ln-n { - margin-right: 0.4em; -} - -/* Numbers in codeblocks */ -.hljs-ln-numbers { - text-align: right; - color: var(--font-color); -} - -/* Fix scroll in codeblocks with line numbering */ -table.hljs-ln { - overflow: hidden; -} - -/* Background for copy code button */ -.hljs-copy-button { - background-color: var(--background) !important; -} - -/* Light theme for the copy code button */ -@media (prefers-color-scheme: light) { - .hljs-copy-button { - background-color: var(--font-color) !important; - filter: invert(100%); - } -} - -/* Hide last line in codeblocks if empty */ -.hljs-ln - > tbody - > tr:last-child:has(td:last-child > span::-moz-only-whitespace) { - visibility: collapse; -} - -/* Temporary fix for layout.css.has-selector.enabled available only on - * Firefox under certain circumstances */ -.hljs-ln > tbody > tr:last-child { - visibility: collapse; -} - -/* Reference to footnotes */ -.footnote-ref a { - text-decoration: underline dotted; - font-size: calc(var(--font-size) * 0.8); -} - -/* Footnote */ -section.footnotes * { - font-size: calc(var(--font-size) * 0.8); -} - -/* When multiple ref */ -a.footnote-backref sup { - font-size: calc(var(--font-size) * 0.6); -} -a.footnote-backref sup::before { - content: "("; -} -a.footnote-backref sup::after { - content: ")"; -} - -/* Footnotes links */ -a.footnote-backref { - font-family: "Segoe UI", "Segoe UI Symbol", system-ui; - text-decoration: underline dotted; -} - -/* Footnotes block separation from article */ -section.footnotes { - margin: 3px; - border-top: 2px dotted var(--separator-color); -} - -/* Mermaid diagrams */ -pre:has(code.language-mermaid) { - text-align: center; -} - /* Table of content */ nav#toc { position: fixed; @@ -246,36 +83,3 @@ nav#toc { visibility: hidden; } } - -@media print { - /* Better colors for paper */ - blockquote { - border-color: black; - background: var(--background); - } - - .hljs { - background: var(--background); - } - - /* Force line numbering to be on top */ - td.hljs-ln-line { - vertical-align: top; - } - - /* Break code */ - code.hljs { - white-space: break-spaces; - hyphens: none; - } - - /* Hide arrows of backref */ - a.footnote-backref { - visibility: hidden; - } - - /* No underline for footnotes */ - .footnote-ref > a { - text-decoration: none; - } -} diff --git a/static/css/cours.css b/static/css/cours.css index 1cd0239..59cb08f 100644 --- a/static/css/cours.css +++ b/static/css/cours.css @@ -1,3 +1,5 @@ +@import "markdown.css"; + /* Filetree */ aside { float: left; @@ -48,6 +50,4 @@ aside li.directory { main img { max-width: 100%; - display: block; - margin: auto; } diff --git a/static/css/markdown.css b/static/css/markdown.css new file mode 100644 index 0000000..7e17c1f --- /dev/null +++ b/static/css/markdown.css @@ -0,0 +1,213 @@ +@media (prefers-color-scheme: light) { + :root { + --code-font-color: #333333; + --code-bg-color: #eeeeee; + --quote-border-color: #9852fa; + --quote-bg-color: #d8d6d6; + --separator-color: #cccccc; + --tag-bg-color: #d2e0f0; + } +} + +@media (prefers-color-scheme: dark) { + :root { + --code-font-color: #eeeeee; + --code-bg-color: #333333; + --quote-border-color: #bd93f9; + --quote-bg-color: #273341; + --separator-color: #414558; + --tag-bg-color: #242e38; + } +} + +/* Page */ +html { + scroll-behavior: smooth; +} + +/* Anchors */ +main :is(h1, h2, h3, h4, h5, h6):hover a.anchor::before { + visibility: visible; +} + +main a.anchor::before { + content: "#"; + visibility: hidden; + padding-right: 0.1em; +} + +main a.anchor { + text-decoration: none; + vertical-align: baseline; +} + +/* Links in headers */ +:is(h1, h2, h3, h4, h5, h6) a { + font-size: inherit; +} + +/* Images */ +main img { + display: block; + margin: auto; +} + +/* Separators */ +hr { + border: 0; + height: 1px; + background: var(--separator-color); +} + +/* Quotes */ +blockquote { + margin: 1em 0; + padding: 0.1em 10px; + border-left: 6px solid; + border-color: var(--quote-border-color); + background: var(--quote-bg-color); + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; +} + +/* Little snippet of code (not blocks) */ +kbd, +code:not(.hljs):not(:has(svg)) { + background: var(--code-bg-color); + border-radius: 3px; + color: var(--code-font-color); + box-shadow: 0 1px 1px black; + font-size: calc(var(--font-size) * 0.8); + padding: 2px 4px; + vertical-align: 1.5px; +} + +/* Code blocks */ +.hljs { + border-radius: 5px; +} + +.hljs::-webkit-scrollbar { + width: 7px; + height: 9px; + background: var(--background); +} + +.hljs::-webkit-scrollbar-thumb { + background-color: var(--font-color); + border-radius: 10px; +} + +/* Marge for numbers */ +.hljs-ln-n { + margin-right: 0.4em; +} + +/* Numbers in codeblocks */ +.hljs-ln-numbers { + text-align: right; + color: var(--font-color); +} + +/* Fix scroll in codeblocks with line numbering */ +table.hljs-ln { + overflow: hidden; +} + +/* Background for copy code button */ +.hljs-copy-button { + background-color: var(--background) !important; +} + +/* Light theme for the copy code button */ +@media (prefers-color-scheme: light) { + .hljs-copy-button { + background-color: var(--font-color) !important; + filter: invert(100%); + } +} + +/* Hide last line in codeblocks if empty */ +.hljs-ln + > tbody + > tr:last-child:has(td:last-child > span::-moz-only-whitespace) { + visibility: collapse; +} + +/* Temporary fix for layout.css.has-selector.enabled available only on + * Firefox under certain circumstances */ +.hljs-ln > tbody > tr:last-child { + visibility: collapse; +} + +/* Reference to footnotes */ +.footnote-ref a { + text-decoration: underline dotted; + font-size: calc(var(--font-size) * 0.8); +} + +/* Footnote */ +section.footnotes * { + font-size: calc(var(--font-size) * 0.8); +} + +/* When multiple ref */ +a.footnote-backref sup { + font-size: calc(var(--font-size) * 0.6); +} +a.footnote-backref sup::before { + content: "("; +} +a.footnote-backref sup::after { + content: ")"; +} + +/* Footnotes links */ +a.footnote-backref { + font-family: "Segoe UI", "Segoe UI Symbol", system-ui; + text-decoration: underline dotted; +} + +/* Footnotes block separation from content */ +section.footnotes { + margin: 3px; + border-top: 2px dotted var(--separator-color); +} + +/* Mermaid diagrams */ +pre:has(code.language-mermaid) { + text-align: center; +} + +@media print { + /* Better colors for paper */ + blockquote { + border-color: black; + background: var(--background); + } + + .hljs { + background: var(--background); + } + + /* Force line numbering to be on top */ + td.hljs-ln-line { + vertical-align: top; + } + + /* Break code */ + code.hljs { + white-space: break-spaces; + hyphens: none; + } + + /* Hide arrows of backref */ + a.footnote-backref { + visibility: hidden; + } + + /* No underline for footnotes */ + .footnote-ref > a { + text-decoration: none; + } +}