Skip to content

Commit 9b107c8

Browse files
committed
Chroma: Add vs theme to mainframe
This removes the custom render-codeblock as it generated html and class references that would not work with the standard chroma theme generator. We may create another render-codeblock in future, if we require a fully custom theme to render our "fancy codeblocks".
1 parent c8c7853 commit 9b107c8

File tree

6 files changed

+211
-32
lines changed

6 files changed

+211
-32
lines changed

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

exampleSite/content/nginx/installing-nginx-open-source.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,122 @@ toc: true
99
weight: 200
1010
---
1111

12+
```nginx
13+
14+
# Global Configuration
15+
user nginx;
16+
worker_processes auto;
17+
18+
error_log /var/log/nginx/error.log warn;
19+
pid /var/run/nginx.pid;
20+
21+
events {
22+
worker_connections 1024;
23+
}
24+
25+
http {
26+
include /etc/nginx/mime.types;
27+
default_type application/octet-stream;
28+
29+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
30+
'$status $body_bytes_sent "$http_referer" '
31+
'"$http_user_agent" "$http_x_forwarded_for"';
32+
33+
access_log /var/log/nginx/access.log main;
34+
35+
sendfile on;
36+
keepalive_timeout 65;
37+
38+
# Standalone IP addresses for upstream definitions
39+
upstream backend {
40+
server 192.168.0.1:8080; # IP address without a port
41+
server 192.168.0.2; # Another standalone IP
42+
server 10.0.0.1 max_fails=2 fail_timeout=10s; # Failover setup
43+
}
44+
45+
# Proxy settings
46+
server {
47+
listen 80;
48+
server_name www.example.com;
49+
50+
root /usr/share/nginx/html;
51+
52+
location /api/ {
53+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54+
proxy_set_header Host $host;
55+
proxy_pass http://192.168.1.100; # Proxying to an IP without a port
56+
}
57+
58+
location /images/ {
59+
root /img;
60+
autoindex on;
61+
}
62+
}
63+
64+
# ACL with standalone IP ranges
65+
acl_list {
66+
allow 192.168.1.0; # Specific single IP without port
67+
allow 192.168.0.0/16; # IP range without ports
68+
deny 10.1.0.1; # Single forbidden IP
69+
}
70+
71+
# Static file serving with regex
72+
location ~* \.(gif|png|jpg|jpeg)$ {
73+
expires 30d;
74+
access_log off;
75+
}
76+
77+
# Standalone IPs used for error logging
78+
error_log /var/log/nginx/error.log warn;
79+
error_log 192.168.1.200; # Logs sent to external IP
80+
}
81+
82+
server {
83+
listen 443 ssl;
84+
server_name secure.example.com;
85+
86+
ssl_certificate /etc/nginx/ssl/server.crt;
87+
ssl_certificate_key /etc/nginx/ssl/server.key;
88+
89+
root /usr/share/nginx/secure_html;
90+
91+
location ~ \.php$ {
92+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
93+
fastcgi_pass 127.0.0.1; # PHP processing via standalone IP (localhost IP)
94+
include fastcgi_params;
95+
}
96+
97+
location /logs/ {
98+
deny all; # Deny presence of specific logs
99+
}
100+
}
101+
102+
server {
103+
listen 8080;
104+
server_name localhost;
105+
106+
# Error page definitions
107+
error_page 404 /404.html;
108+
location = /404.html {
109+
root /usr/share/nginx/html;
110+
}
111+
112+
error_page 500 502 503 504 /50x.html;
113+
location = /50x.html {
114+
root /usr/share/nginx/html;
115+
}
116+
}
117+
118+
```
119+
120+
```js
121+
function hello() {
122+
// this is a comment
123+
console.log("Hello world!");
124+
const thing = ["a", "string", "array"];
125+
}
126+
```
127+
12128
This article explains how to install NGINX Open Source.
13129

14130
<span id="stable_vs_mainline"></span>

exampleSite/hugo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ maxAge = -1
1717
[markup.goldmark.renderer]
1818
unsafe = true
1919
[markup.highlight]
20-
guessSyntax = true
20+
guessSyntax = true
21+
noClasses = false

layouts/_default/_markup/render-codeblock.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

layouts/_default/baseof.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
}
4949
});
5050

51-
const v2cssIds = ["css7"];
51+
const v2cssIds = ["css7", "css9"];
5252
v2cssIds.forEach((cssId) => {
5353
const element = document.getElementById(cssId);
5454
if (element !== null) {
@@ -75,10 +75,6 @@
7575
table.style.display = isNewTheme ? "none" : "";
7676
});
7777

78-
document.querySelectorAll(".highlight").forEach((codeblock) => {
79-
codeblock.style.display = isNewTheme ? "none" : "";
80-
});
81-
8278
const mfElements = ['[data-mf="true"]'];
8379
mfElements.forEach((elementId) => {
8480
document.querySelectorAll(elementId).forEach((element) => {

layouts/partials/styles.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{{ $css6 := resources.Get "css/coveo.css" }}
77
{{ $css7 := resources.Get "css/v2/style.css" }}
88
{{ $css8 := resources.Get "css/inline-overrides.css" }}
9+
{{ $css9 := resources.Get "css/v2/highlight.css" }}
910

1011
<!-- load v2 theme assets -->
1112
<link href="{{ $css7.RelPermalink }}" integrity="{{ $css7.Data.Integrity }}" rel="stylesheet" type="text/css" id="css7"
@@ -14,6 +15,9 @@
1415
{{ $cssInter := resources.Get "css/inter/inter.css" | fingerprint "sha512" }}
1516
<link href="{{ $cssInter.RelPermalink }}" integrity="{{ $cssInter.Data.Integrity }}" rel="stylesheet" type="text/css"
1617
id="cssInter">
18+
19+
{{ $cssHighlight := $css9 | minify | fingerprint "sha512"}}
20+
<link href="{{ $cssHighlight.RelPermalink }}" rel="stylesheet" type="text/css" id="css9">
1721
<!-- end v2 theme assets -->
1822

1923

0 commit comments

Comments
 (0)