From 38db33400588783ee24867a76277b626d2f8ade1 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 16 Oct 2023 11:58:46 -0500 Subject: [PATCH] support displaying prompt symbol on command blocks --- config/_default/markup.toml | 6 +- .../render-codeblock-command-session.html | 3 + .../_markup/render-codeblock-command.html | 3 + .../render-codeblock-commandroot-session.html | 3 + .../_markup/render-codeblock-commandroot.html | 3 + static/css/custom.css | 31 +++++++ static/css/palettes/runtimeterror.css | 4 +- static/css/syntax.css | 86 +++++++++++++++++++ 8 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 layouts/_default/_markup/render-codeblock-command-session.html create mode 100644 layouts/_default/_markup/render-codeblock-command.html create mode 100644 layouts/_default/_markup/render-codeblock-commandroot-session.html create mode 100644 layouts/_default/_markup/render-codeblock-commandroot.html create mode 100644 static/css/syntax.css diff --git a/config/_default/markup.toml b/config/_default/markup.toml index ad52c8e..81fc728 100644 --- a/config/_default/markup.toml +++ b/config/_default/markup.toml @@ -11,12 +11,12 @@ codeFences = true guessSyntax = true hl_Lines = '' - lineAnchors = '' - lineNos = true + lineNos = false lineNoStart = 1 lineNumbersInTable = false - noClasses = true + noClasses = false tabwidth = 2 + style = 'monokai' # Table of contents # Add toc = true to content front matter to enable diff --git a/layouts/_default/_markup/render-codeblock-command-session.html b/layouts/_default/_markup/render-codeblock-command-session.html new file mode 100644 index 0000000..6386861 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-command-session.html @@ -0,0 +1,3 @@ +
+ {{- highlight .Inner "bash" -}} +
diff --git a/layouts/_default/_markup/render-codeblock-command.html b/layouts/_default/_markup/render-codeblock-command.html new file mode 100644 index 0000000..6dd6714 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-command.html @@ -0,0 +1,3 @@ +
+ {{- highlight .Inner "bash" -}} +
diff --git a/layouts/_default/_markup/render-codeblock-commandroot-session.html b/layouts/_default/_markup/render-codeblock-commandroot-session.html new file mode 100644 index 0000000..f148561 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-commandroot-session.html @@ -0,0 +1,3 @@ +
+ {{- highlight .Inner "bash" -}} +
diff --git a/layouts/_default/_markup/render-codeblock-commandroot.html b/layouts/_default/_markup/render-codeblock-commandroot.html new file mode 100644 index 0000000..e3d93ad --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-commandroot.html @@ -0,0 +1,3 @@ +
+ {{- highlight .Inner "bash" -}} +
diff --git a/static/css/custom.css b/static/css/custom.css index eaf156b..d09bd0d 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,3 +1,5 @@ +@import 'syntax.css'; + /* override page max-width */ .page { max-width: 72rem; @@ -133,3 +135,32 @@ body.dark .notice { top: 0.125em; position: relative; } + +/* Insert prompt char ::before on every line in command codeblocks */ +.command .line {display: inherit;} +.command .line::before { + color: var(--base07); + content: "$ "; +} + +.commandroot .line {display: inherit;} +.commandroot .line::before { + color: var(--base08); + content: "# "; +} + +/* Insert prompt char ::before on first line in cmd-session codeblocks +(These are useful for showing returned values from commands) +*/ +.command-session .line {display: inherit;} +.command-session code::before { + color: var(--base07); + content: "$ "; +} + +.commandroot-session .line {display: inherit;} +.commandroot-session code::before { + color: var(--base08); + content: "# "; +} + diff --git a/static/css/palettes/runtimeterror.css b/static/css/palettes/runtimeterror.css index ce408d4..c12bebf 100644 --- a/static/css/palettes/runtimeterror.css +++ b/static/css/palettes/runtimeterror.css @@ -9,8 +9,8 @@ --base04: #959494; /* alt foreground */ --base05: #d8d8d8; /* foreground */ --base06: #e8e8e8; - --base07: #f8f8f8; - --base08: #ab4642; + --base07: #5f8700; /* user prompt */ + --base08: #ab4642; /* root prompt */ --base09: #dc9656; --base0A: #f7ca88; /* highlights */ --base0B: #772a28; /* primary accent */ diff --git a/static/css/syntax.css b/static/css/syntax.css new file mode 100644 index 0000000..2920331 --- /dev/null +++ b/static/css/syntax.css @@ -0,0 +1,86 @@ +/* Background */ .bg { color: #f8f8f2; background-color: #272822; } +/* PreWrapper */ .chroma { color: #f8f8f2; background-color: #272822; } +/* Other */ .chroma .x { } +/* Error */ .chroma .err { color: #960050; background-color: #1e0010 } +/* CodeLine */ .chroma .cl { } +/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; } +/* LineHighlight */ .chroma .hl { background-color: #ffffcc } +/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* Line */ .chroma .line { display: flex; } +/* Keyword */ .chroma .k { color: #66d9ef } +/* KeywordConstant */ .chroma .kc { color: #66d9ef } +/* KeywordDeclaration */ .chroma .kd { color: #66d9ef } +/* KeywordNamespace */ .chroma .kn { color: #f92672 } +/* KeywordPseudo */ .chroma .kp { color: #66d9ef } +/* KeywordReserved */ .chroma .kr { color: #66d9ef } +/* KeywordType */ .chroma .kt { color: #66d9ef } +/* Name */ .chroma .n { } +/* NameAttribute */ .chroma .na { color: #a6e22e } +/* NameBuiltin */ .chroma .nb { } +/* NameBuiltinPseudo */ .chroma .bp { } +/* NameClass */ .chroma .nc { color: #a6e22e } +/* NameConstant */ .chroma .no { color: #66d9ef } +/* NameDecorator */ .chroma .nd { color: #a6e22e } +/* NameEntity */ .chroma .ni { } +/* NameException */ .chroma .ne { color: #a6e22e } +/* NameFunction */ .chroma .nf { color: #a6e22e } +/* NameFunctionMagic */ .chroma .fm { } +/* NameLabel */ .chroma .nl { } +/* NameNamespace */ .chroma .nn { } +/* NameOther */ .chroma .nx { color: #a6e22e } +/* NameProperty */ .chroma .py { } +/* NameTag */ .chroma .nt { color: #f92672 } +/* NameVariable */ .chroma .nv { } +/* NameVariableClass */ .chroma .vc { } +/* NameVariableGlobal */ .chroma .vg { } +/* NameVariableInstance */ .chroma .vi { } +/* NameVariableMagic */ .chroma .vm { } +/* Literal */ .chroma .l { color: #ae81ff } +/* LiteralDate */ .chroma .ld { color: #e6db74 } +/* LiteralString */ .chroma .s { color: #e6db74 } +/* LiteralStringAffix */ .chroma .sa { color: #e6db74 } +/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 } +/* LiteralStringChar */ .chroma .sc { color: #e6db74 } +/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 } +/* LiteralStringDoc */ .chroma .sd { color: #e6db74 } +/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 } +/* LiteralStringEscape */ .chroma .se { color: #ae81ff } +/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 } +/* LiteralStringInterpol */ .chroma .si { color: #e6db74 } +/* LiteralStringOther */ .chroma .sx { color: #e6db74 } +/* LiteralStringRegex */ .chroma .sr { color: #e6db74 } +/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 } +/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 } +/* LiteralNumber */ .chroma .m { color: #ae81ff } +/* LiteralNumberBin */ .chroma .mb { color: #ae81ff } +/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff } +/* LiteralNumberHex */ .chroma .mh { color: #ae81ff } +/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff } +/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff } +/* LiteralNumberOct */ .chroma .mo { color: #ae81ff } +/* Operator */ .chroma .o { color: #f92672 } +/* OperatorWord */ .chroma .ow { color: #f92672 } +/* Punctuation */ .chroma .p { } +/* Comment */ .chroma .c { color: #75715e } +/* CommentHashbang */ .chroma .ch { color: #75715e } +/* CommentMultiline */ .chroma .cm { color: #75715e } +/* CommentSingle */ .chroma .c1 { color: #75715e } +/* CommentSpecial */ .chroma .cs { color: #75715e } +/* CommentPreproc */ .chroma .cp { color: #75715e } +/* CommentPreprocFile */ .chroma .cpf { color: #75715e } +/* Generic */ .chroma .g { } +/* GenericDeleted */ .chroma .gd { color: #f92672 } +/* GenericEmph */ .chroma .ge { font-style: italic } +/* GenericError */ .chroma .gr { } +/* GenericHeading */ .chroma .gh { } +/* GenericInserted */ .chroma .gi { color: #a6e22e } +/* GenericOutput */ .chroma .go { } +/* GenericPrompt */ .chroma .gp { } +/* GenericStrong */ .chroma .gs { font-weight: bold } +/* GenericSubheading */ .chroma .gu { color: #75715e } +/* GenericTraceback */ .chroma .gt { } +/* GenericUnderline */ .chroma .gl { } +/* TextWhitespace */ .chroma .w { }