Public Access
1
0

feat: prism and command-line plugin
All checks were successful
Build and Push Docker Image to Gitea / build-and-push-to-gitea (push) Successful in 1m18s

This commit is contained in:
2025-09-06 01:27:40 -04:00
parent c9412d2a34
commit d35c154396
6 changed files with 29 additions and 124 deletions

View File

@@ -13,7 +13,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({ "src/favicon" : "/" } ); eleventyConfig.addPassthroughCopy({ "src/favicon" : "/" } );
eleventyConfig.addPassthroughCopy({ 'src/robots.txt': '/robots.txt' }); eleventyConfig.addPassthroughCopy({ 'src/robots.txt': '/robots.txt' });
eleventyConfig.addPassthroughCopy({ 'src/sitemap.xml': '/sitemap.xml' }); eleventyConfig.addPassthroughCopy({ 'src/sitemap.xml': '/sitemap.xml' });
eleventyConfig.addPassthroughCopy("src/css/prism-tomorrow.css"); eleventyConfig.addPassthroughCopy("src/css/prism.css");
eleventyConfig.addPassthroughCopy("src/assets/fontawesome"); eleventyConfig.addPassthroughCopy("src/assets/fontawesome");
eleventyConfig.addPassthroughCopy("src/assets/googlefonts"); eleventyConfig.addPassthroughCopy("src/assets/googlefonts");
@@ -46,6 +46,14 @@ module.exports = function(eleventyConfig) {
</div>`; </div>`;
}); });
// Shortcode for creating a console output
// This is a "paired shortcode" which means it has a start and end tag.
eleventyConfig.addPairedShortcode("command", function(content, user, host, output,) {
return `<pre class="command-line language-bash" data-user="${ user }" data-host="${ host }" data-output="${ output }">
<code class="language-bash">${content}</code>
</pre>`;
});
// Add a shortcode for the current year for the footer // Add a shortcode for the current year for the footer
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`); eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);

View File

@@ -46,7 +46,7 @@
{% endif %} {% endif %}
<link rel="stylesheet" href="/css/style.css?v={{ buildTime }}"> <link rel="stylesheet" href="/css/style.css?v={{ buildTime }}">
<link rel="stylesheet" href="/assets/fontawesome/css/all.min.css"> <link rel="stylesheet" href="/assets/fontawesome/css/all.min.css">
<link rel="stylesheet" href="/css/prism-tomorrow.css?v={{ buildTime }}"> <link rel="stylesheet" href="/css/prism.css">
<link rel="canonical" href="{{ site.url }}{{ page.url }}"> <link rel="canonical" href="{{ site.url }}{{ page.url }}">
{% if image %} {% if image %}
<link rel="preload" as="image" href="{{ image }}"> <link rel="preload" as="image" href="{{ image }}">

View File

@@ -43,4 +43,5 @@ layout: "layout.njk"
</article> </article>
<script src="/js/like-button.js"></script> <script src="/js/like-button.js"></script>
<script src="/js/view-counter.js"></script> <script src="/js/view-counter.js"></script>
<script src="/js/prism.js"></script>
<div id="bottom"></div> <div id="bottom"></div>

View File

@@ -1,122 +0,0 @@
/**
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
* Based on https://github.com/chriskempson/tomorrow-theme
* @author Rose Pritchard
*/
code[class*="language-"],
pre[class*="language-"] {
color: #ccc;
background: none;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #2d2d2d;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #999;
}
.token.punctuation {
color: #ccc;
}
.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
color: #e2777a;
}
.token.function-name {
color: #6196cc;
}
.token.boolean,
.token.number,
.token.function {
color: #f08d49;
}
.token.property,
.token.class-name,
.token.constant,
.token.symbol {
color: #f8c555;
}
.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
color: #cc99cd;
}
.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
color: #7ec699;
}
.token.operator,
.token.entity,
.token.url {
color: #67cdcc;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.inserted {
color: green;
}

5
src/css/prism.css Normal file
View File

@@ -0,0 +1,5 @@
/* PrismJS 1.30.0
https://prismjs.com/download#themes=prism-tomorrow&languages=markup+css+clike+javascript+bash+json+log&plugins=command-line+toolbar+copy-to-clipboard */
code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}
.command-line-prompt{border-right:1px solid #999;display:block;float:left;font-size:100%;letter-spacing:-1px;margin-right:1em;pointer-events:none;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.command-line-prompt>span:before{opacity:.7;content:' ';display:block;padding-right:.8em}.command-line-prompt>span[data-user]:before{content:"[" attr(data-user) "@" attr(data-host) "] $"}.command-line-prompt>span[data-user=root]:before{content:"[" attr(data-user) "@" attr(data-host) "] #"}.command-line-prompt>span[data-prompt]:before{content:attr(data-prompt)}.command-line-prompt>span[data-continuation-prompt]:before{content:attr(data-continuation-prompt)}.command-line span.token.output{opacity:.7}
div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}

13
src/js/prism.js Normal file

File diff suppressed because one or more lines are too long