From a10a198aae999b93c867e572ab1f8408413bb353 Mon Sep 17 00:00:00 2001 From: mostafaei2002 Date: Thu, 16 May 2024 10:38:09 +0330 Subject: [PATCH] fix: setup prettyprint --- docs_theme/main.html | 1 + docs_theme/src/js/main.js | 5 +++ docs_theme/src/scss/styles.scss | 71 ++++++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/docs_theme/main.html b/docs_theme/main.html index 537872aae..e1075bb06 100644 --- a/docs_theme/main.html +++ b/docs_theme/main.html @@ -193,6 +193,7 @@ + {% for path in config.extra_javascript %} diff --git a/docs_theme/src/js/main.js b/docs_theme/src/js/main.js index 1673d36b5..855bddd65 100644 --- a/docs_theme/src/js/main.js +++ b/docs_theme/src/js/main.js @@ -12,3 +12,8 @@ import "../../node_modules/bootstrap/js/dist/toast"; import "../../node_modules/bootstrap/js/dist/tooltip"; import "../scss/styles.scss"; + +const codeBlocks = document.querySelectorAll("pre code"); +codeBlocks.forEach((block) => { + block.parentElement.classList.add(["prettyprint", "well"]); +}); diff --git a/docs_theme/src/scss/styles.scss b/docs_theme/src/scss/styles.scss index 30a1f05ab..9501d9c15 100644 --- a/docs_theme/src/scss/styles.scss +++ b/docs_theme/src/scss/styles.scss @@ -66,6 +66,12 @@ $code-color: #d14; a { color: #a30000; text-decoration: none; + + &:hover, + &:active { + color: #c20000; + text-decoration: underline; + } } pre.prettyprint { @@ -86,6 +92,18 @@ code { padding: 2px 4px; } +pre { + background-color: #f7f7f9; +} + +pre code { + border: none; +} + +.nav-link { + padding: 2px 15px 3px; +} + .body-content { padding-top: 120px; padding-bottom: 70px; @@ -101,4 +119,55 @@ code { color: #333; } -// Code Blocks +// Prettify Code +.com { + color: #93a1a1; +} +.lit { + color: #195f91; +} +.pun, +.opn, +.clo { + color: #93a1a1; +} +.fun { + color: #dc322f; +} +.str, +.atv { + color: #d14; +} +.kwd, +.prettyprint .tag { + color: #1e347b; +} +.typ, +.atn, +.dec, +.var { + color: teal; +} +.pln { + color: #48484c; +} + +.prettyprint { + padding: 8px; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; +} +.prettyprint.linenums { + box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin: 0 0 0 33px; /* IE indents via margin-left */ +} +ol.linenums li { + padding-left: 12px; + color: #bebec5; + line-height: 20px; + text-shadow: 0 1px 0 #fff; +}