Skip to content

Commit 1609c66

Browse files
authored
Add syntax highlighting to AsciiDoc (#10)
1 parent a28839c commit 1609c66

File tree

4 files changed

+96
-2
lines changed

4 files changed

+96
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
3535
- name: Install Dart Sass
3636
run: sudo snap install dart-sass
37-
- name: Install asciidoctor
38-
run: sudo apt -y install asciidoctor
37+
- name: Install asciidoctor and ruby-rouge
38+
run: sudo apt -y install asciidoctor ruby-rouge
3939
- name: Install Java 21
4040
uses: actions/setup-java@v4
4141
with:

assets/css/asciidoc_syntax.css

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/* Generated using: hugo gen chromastyles --style=catppuccin-macchiato | sed 's/\.chroma/.rouge.highlight/g' > assets/css/asciidoc_syntax.css */
2+
3+
/* Background */ .bg { color:#cad3f5;background-color:#24273a; }
4+
/* PreWrapper */ .rouge.highlight { color:#cad3f5;background-color:#24273a; }
5+
/* Other */ .rouge.highlight .x { }
6+
/* Error */ .rouge.highlight .err { color:#ed8796 }
7+
/* CodeLine */ .rouge.highlight .cl { }
8+
/* LineLink */ .rouge.highlight .lnlinks { outline:none;text-decoration:none;color:inherit }
9+
/* LineTableTD */ .rouge.highlight .lntd { vertical-align:top;padding:0;margin:0;border:0; }
10+
/* LineTable */ .rouge.highlight .lntable { border-spacing:0;padding:0;margin:0;border:0; }
11+
/* LineHighlight */ .rouge.highlight .hl { background-color:#494d64 }
12+
/* LineNumbersTable */ .rouge.highlight .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2 }
13+
/* LineNumbers */ .rouge.highlight .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2 }
14+
/* Line */ .rouge.highlight .line { display:flex; }
15+
/* Keyword */ .rouge.highlight .k { color:#c6a0f6 }
16+
/* KeywordConstant */ .rouge.highlight .kc { color:#f5a97f }
17+
/* KeywordDeclaration */ .rouge.highlight .kd { color:#ed8796 }
18+
/* KeywordNamespace */ .rouge.highlight .kn { color:#8bd5ca }
19+
/* KeywordPseudo */ .rouge.highlight .kp { color:#c6a0f6 }
20+
/* KeywordReserved */ .rouge.highlight .kr { color:#c6a0f6 }
21+
/* KeywordType */ .rouge.highlight .kt { color:#ed8796 }
22+
/* Name */ .rouge.highlight .n { }
23+
/* NameAttribute */ .rouge.highlight .na { color:#8aadf4 }
24+
/* NameClass */ .rouge.highlight .nc { color:#eed49f }
25+
/* NameConstant */ .rouge.highlight .no { color:#eed49f }
26+
/* NameDecorator */ .rouge.highlight .nd { color:#8aadf4;font-weight:bold }
27+
/* NameEntity */ .rouge.highlight .ni { color:#8bd5ca }
28+
/* NameException */ .rouge.highlight .ne { color:#f5a97f }
29+
/* NameLabel */ .rouge.highlight .nl { color:#91d7e3 }
30+
/* NameNamespace */ .rouge.highlight .nn { color:#f5a97f }
31+
/* NameOther */ .rouge.highlight .nx { }
32+
/* NameProperty */ .rouge.highlight .py { color:#f5a97f }
33+
/* NameTag */ .rouge.highlight .nt { color:#c6a0f6 }
34+
/* NameBuiltin */ .rouge.highlight .nb { color:#91d7e3 }
35+
/* NameBuiltinPseudo */ .rouge.highlight .bp { color:#91d7e3 }
36+
/* NameVariable */ .rouge.highlight .nv { color:#f4dbd6 }
37+
/* NameVariableClass */ .rouge.highlight .vc { color:#f4dbd6 }
38+
/* NameVariableGlobal */ .rouge.highlight .vg { color:#f4dbd6 }
39+
/* NameVariableInstance */ .rouge.highlight .vi { color:#f4dbd6 }
40+
/* NameVariableMagic */ .rouge.highlight .vm { color:#f4dbd6 }
41+
/* NameFunction */ .rouge.highlight .nf { color:#8aadf4 }
42+
/* NameFunctionMagic */ .rouge.highlight .fm { color:#8aadf4 }
43+
/* Literal */ .rouge.highlight .l { }
44+
/* LiteralDate */ .rouge.highlight .ld { }
45+
/* LiteralString */ .rouge.highlight .s { color:#a6da95 }
46+
/* LiteralStringAffix */ .rouge.highlight .sa { color:#ed8796 }
47+
/* LiteralStringBacktick */ .rouge.highlight .sb { color:#a6da95 }
48+
/* LiteralStringChar */ .rouge.highlight .sc { color:#a6da95 }
49+
/* LiteralStringDelimiter */ .rouge.highlight .dl { color:#8aadf4 }
50+
/* LiteralStringDoc */ .rouge.highlight .sd { color:#6e738d }
51+
/* LiteralStringDouble */ .rouge.highlight .s2 { color:#a6da95 }
52+
/* LiteralStringEscape */ .rouge.highlight .se { color:#8aadf4 }
53+
/* LiteralStringHeredoc */ .rouge.highlight .sh { color:#6e738d }
54+
/* LiteralStringInterpol */ .rouge.highlight .si { color:#a6da95 }
55+
/* LiteralStringOther */ .rouge.highlight .sx { color:#a6da95 }
56+
/* LiteralStringRegex */ .rouge.highlight .sr { color:#8bd5ca }
57+
/* LiteralStringSingle */ .rouge.highlight .s1 { color:#a6da95 }
58+
/* LiteralStringSymbol */ .rouge.highlight .ss { color:#a6da95 }
59+
/* LiteralNumber */ .rouge.highlight .m { color:#f5a97f }
60+
/* LiteralNumberBin */ .rouge.highlight .mb { color:#f5a97f }
61+
/* LiteralNumberFloat */ .rouge.highlight .mf { color:#f5a97f }
62+
/* LiteralNumberHex */ .rouge.highlight .mh { color:#f5a97f }
63+
/* LiteralNumberInteger */ .rouge.highlight .mi { color:#f5a97f }
64+
/* LiteralNumberIntegerLong */ .rouge.highlight .il { color:#f5a97f }
65+
/* LiteralNumberOct */ .rouge.highlight .mo { color:#f5a97f }
66+
/* Operator */ .rouge.highlight .o { color:#91d7e3;font-weight:bold }
67+
/* OperatorWord */ .rouge.highlight .ow { color:#91d7e3;font-weight:bold }
68+
/* Punctuation */ .rouge.highlight .p { }
69+
/* Comment */ .rouge.highlight .c { color:#6e738d;font-style:italic }
70+
/* CommentHashbang */ .rouge.highlight .ch { color:#6e738d;font-style:italic }
71+
/* CommentMultiline */ .rouge.highlight .cm { color:#6e738d;font-style:italic }
72+
/* CommentSingle */ .rouge.highlight .c1 { color:#6e738d;font-style:italic }
73+
/* CommentSpecial */ .rouge.highlight .cs { color:#6e738d;font-style:italic }
74+
/* CommentPreproc */ .rouge.highlight .cp { color:#6e738d;font-style:italic }
75+
/* CommentPreprocFile */ .rouge.highlight .cpf { color:#6e738d;font-weight:bold;font-style:italic }
76+
/* Generic */ .rouge.highlight .g { }
77+
/* GenericDeleted */ .rouge.highlight .gd { color:#ed8796;background-color:#363a4f }
78+
/* GenericEmph */ .rouge.highlight .ge { font-style:italic }
79+
/* GenericError */ .rouge.highlight .gr { color:#ed8796 }
80+
/* GenericHeading */ .rouge.highlight .gh { color:#f5a97f;font-weight:bold }
81+
/* GenericInserted */ .rouge.highlight .gi { color:#a6da95;background-color:#363a4f }
82+
/* GenericOutput */ .rouge.highlight .go { }
83+
/* GenericPrompt */ .rouge.highlight .gp { }
84+
/* GenericStrong */ .rouge.highlight .gs { font-weight:bold }
85+
/* GenericSubheading */ .rouge.highlight .gu { color:#f5a97f;font-weight:bold }
86+
/* GenericTraceback */ .rouge.highlight .gt { color:#ed8796 }
87+
/* GenericUnderline */ .rouge.highlight .gl { text-decoration:underline }
88+
/* TextWhitespace */ .rouge.highlight .w { }

hugo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ enableGitInfo = true
2828
verbose = false
2929
workingFolderCurrent = true
3030

31+
[markup.asciidocExt.attributes]
32+
source-highlighter = 'rouge'
33+
3134
[params]
3235
# (Optional, default light) Sets color theme: light, dark or auto.
3336
# Theme 'auto' switches between dark and light modes based on browser/os preferences
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ with resources.Get "css/asciidoc_syntax.css" }}
2+
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
3+
{{ end }}

0 commit comments

Comments
 (0)