Highlight unlabeled blocks

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent e041143b27
commit 5bf9a45007
10 changed files with 498 additions and 367 deletions

281
app.css
View File

@ -172,6 +172,9 @@ main {
padding: 0 1em; padding: 0 1em;
} }
/* Overrule pandoc style */
div.sourceCode { margin: inherit; }
main * { main * {
text-align: left; text-align: left;
margin-left: auto; margin-left: auto;
@ -306,7 +309,7 @@ figure figcaption {
} }
pre { pre {
background-color: aliceblue; /* background-color: aliceblue; */
padding: 1em; padding: 1em;
border: 1px solid lightgray; border: 1px solid lightgray;
border-radius: 3px; border-radius: 3px;
@ -456,279 +459,3 @@ table > caption {
font-variant-caps: small-caps; font-variant-caps: small-caps;
} }
/*highlighting.css*/
pre > code.sourceCode {
white-space: pre;
position: relative;
}
pre > code.sourceCode > span {
display: inline-block;
line-height: 1.25;
}
pre > code.sourceCode > span:empty {
height: 1.2em;
}
code.sourceCode > span {
color: inherit;
text-decoration: inherit;
}
div.sourceCode {
margin: 1em auto;
}
pre.sourceCode {
margin: 0;
}
@media screen {
div.sourceCode {
overflow: auto;
}
}
@media print {
pre > code.sourceCode {
white-space: pre-wrap;
}
pre > code.sourceCode > span {
text-indent: -5em;
padding-left: 5em;
}
}
pre.numberSource code
{
counter-reset: source-line 0;
}
pre.numberSource code > span
{
position: relative;
left: -4em;
counter-increment: source-line;
}
pre.numberSource code > span > a:first-child::before
{
content: counter(source-line);
position: relative;
left: -1em;
text-align: right;
vertical-align: baseline;
border: none;
display: inline-block;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
padding: 0 4px;
width: 4em;
color: #aaaaaa;
}
pre.numberSource {
margin-left: 3em;
border-left: 1px solid #aaaaaa;
padding-left: 4px;
}
div.sourceCode
{
}
@media screen {
pre > code.sourceCode > span > a:first-child::before {
text-decoration: underline;
}
}
code span.al {
color: #ff0000;
font-weight: bold;
}
/* Alert */
code span.an {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Annotation */
code span.at {
color: #7d9029;
}
/* Attribute */
code span.bn {
color: #40a070;
}
/* BaseN */
code span.bu {
}
/* BuiltIn */
code span.cf {
color: #007020;
font-weight: bold;
}
/* ControlFlow */
code span.ch {
color: #4070a0;
}
/* Char */
code span.cn {
color: #880000;
}
/* Constant */
code span.co {
color: #60a0b0;
font-style: italic;
}
/* Comment */
code span.cv {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* CommentVar */
code span.do {
color: #ba2121;
font-style: italic;
}
/* Documentation */
code span.dt {
color: #902000;
}
/* DataType */
code span.dv {
color: #40a070;
}
/* DecVal */
code span.er {
color: #ff0000;
font-weight: bold;
}
/* Error */
code span.ex {
}
/* Extension */
code span.fl {
color: #40a070;
}
/* Float */
code span.fu {
color: #06287e;
}
/* Function */
code span.im {
}
/* Import */
code span.in {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Information */
code span.kw {
color: #007020;
font-weight: bold;
}
/* Keyword */
code span.op {
color: #666666;
}
/* Operator */
code span.ot {
color: #007020;
}
/* Other */
code span.pp {
color: #bc7a00;
}
/* Preprocessor */
code span.sc {
color: #4070a0;
}
/* SpecialChar */
code span.ss {
color: #bb6688;
}
/* SpecialString */
code span.st {
color: #4070a0;
}
/* String */
code span.va {
color: #19177c;
}
/* Variable */
code span.vs {
color: #4070a0;
}
/* VerbatimString */
code span.wa {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Warning */

View File

@ -1,3 +1,9 @@
## `nothing`
```
this is jsut some test
```
## `heex` ## `heex`
```heex ```heex

14
html/.gitignore vendored
View File

@ -2,4 +2,18 @@ app.css
code.html code.html
index.html index.html
moonscript.css moonscript.css
pandoc-old.css
pandoc.css
posts/build-a-neovim-qt-appimage-from-source.html
posts/build-static-website-generator-part-1.html
posts/deploy-elixir-generated-html-with-docker-on-digitalocean.html
posts/fix-distortion-introduced-when-transforming-multiview-projections-to-isometric.html
posts/index.html
posts/open-an-iex-shell-from-an-elixir-script.html
posts/publish-markdown-documents-as-static-web-pages-with-pandoc-and-phoenix.html
posts/recursively-list-all-files-in-a-directory-with-elixir.html
posts/resize-a-qemu-disk-image.html
posts/set-up-a-gitweb-server.html
posts/start-erlangs-dialyzer-with-gui-from-a-docker-container.html
posts/test-mix-task-file-modify.html
pygments.css pygments.css

277
pandoc-old.css Normal file
View File

@ -0,0 +1,277 @@
/*highlighting.css*/
pre > code.sourceCode {
white-space: pre;
position: relative;
}
pre > code.sourceCode > span {
display: inline-block;
line-height: 1.25;
}
pre > code.sourceCode > span:empty {
height: 1.2em;
}
code.sourceCode > span {
/* color: inherit; */
/* text-decoration: inherit; */
}
div.sourceCode {
margin: 1em auto;
}
pre.sourceCode {
margin: 0;
}
@media screen {
div.sourceCode {
overflow: auto;
}
}
@media print {
pre > code.sourceCode {
white-space: pre-wrap;
}
pre > code.sourceCode > span {
text-indent: -5em;
padding-left: 5em;
}
}
pre.numberSource code
{
counter-reset: source-line 0;
}
pre.numberSource code > span
{
position: relative;
left: -4em;
counter-increment: source-line;
}
pre.numberSource code > span > a:first-child::before
{
content: counter(source-line);
position: relative;
left: -1em;
text-align: right;
vertical-align: baseline;
border: none;
display: inline-block;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
padding: 0 4px;
width: 4em;
color: #aaaaaa;
}
pre.numberSource {
margin-left: 3em;
border-left: 1px solid #aaaaaa;
padding-left: 4px;
}
div.sourceCode
{
}
@media screen {
pre > code.sourceCode > span > a:first-child::before {
text-decoration: underline;
}
}
code span.al {
color: #ff0000;
font-weight: bold;
}
/* Alert */
code span.an {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Annotation */
code span.at {
color: #7d9029;
}
/* Attribute */
code span.bn {
color: #40a070;
}
/* BaseN */
code span.bu {
}
/* BuiltIn */
code span.cf {
color: #007020;
font-weight: bold;
}
/* ControlFlow */
code span.ch {
color: #4070a0;
}
/* Char */
code span.cn {
color: #880000;
}
/* Constant */
code span.co {
color: #60a0b0;
font-style: italic;
}
/* Comment */
code span.cv {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* CommentVar */
code span.do {
color: #ba2121;
font-style: italic;
}
/* Documentation */
code span.dt {
color: #902000;
}
/* DataType */
code span.dv {
color: #40a070;
}
/* DecVal */
code span.er {
color: #ff0000;
font-weight: bold;
}
/* Error */
code span.ex {
}
/* Extension */
code span.fl {
color: #40a070;
}
/* Float */
code span.fu {
color: #06287e;
}
/* Function */
code span.im {
}
/* Import */
code span.in {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Information */
code span.kw {
color: #007020;
font-weight: bold;
}
/* Keyword */
code span.op {
color: #666666;
}
/* Operator */
code span.ot {
color: #007020;
}
/* Other */
code span.pp {
color: #bc7a00;
}
/* Preprocessor */
code span.sc {
color: #4070a0;
}
/* SpecialChar */
code span.ss {
color: #bb6688;
}
/* SpecialString */
code span.st {
color: #4070a0;
}
/* String */
code span.va {
color: #19177c;
}
/* Variable */
code span.vs {
color: #4070a0;
}
/* VerbatimString */
code span.wa {
color: #60a0b0;
font-weight: bold;
font-style: italic;
}
/* Warning */

67
pandoc.css Normal file
View File

@ -0,0 +1,67 @@
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
background-color: #232629;
color: #7a7c7d;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #7a7c7d; padding-left: 4px; }
div.sourceCode
{ color: #cfcfc2; background-color: #232629; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #cfcfc2; } /* Normal */
code span.al { color: #95da4c; background-color: #4d1f24; font-weight: bold; } /* Alert */
code span.an { color: #3f8058; } /* Annotation */
code span.at { color: #2980b9; } /* Attribute */
code span.bn { color: #f67400; } /* BaseN */
code span.bu { color: #7f8c8d; } /* BuiltIn */
code span.cf { color: #fdbc4b; font-weight: bold; } /* ControlFlow */
code span.ch { color: #3daee9; } /* Char */
code span.cn { color: #27aeae; font-weight: bold; } /* Constant */
code span.co { color: #7a7c7d; } /* Comment */
code span.cv { color: #7f8c8d; } /* CommentVar */
code span.do { color: #a43340; } /* Documentation */
code span.dt { color: #2980b9; } /* DataType */
code span.dv { color: #f67400; } /* DecVal */
code span.er { color: #da4453; text-decoration: underline; } /* Error */
code span.ex { color: #0099ff; font-weight: bold; } /* Extension */
code span.fl { color: #f67400; } /* Float */
code span.fu { color: #8e44ad; } /* Function */
code span.im { color: #27ae60; } /* Import */
code span.in { color: #c45b00; } /* Information */
code span.kw { color: #cfcfc2; font-weight: bold; } /* Keyword */
code span.op { color: #cfcfc2; } /* Operator */
code span.ot { color: #27ae60; } /* Other */
code span.pp { color: #27ae60; } /* Preprocessor */
code span.re { color: #2980b9; background-color: #153042; } /* RegionMarker */
code span.sc { color: #3daee9; } /* SpecialChar */
code span.ss { color: #da4453; } /* SpecialString */
code span.st { color: #f44f4f; } /* String */
code span.va { color: #27aeae; } /* Variable */
code span.vs { color: #da4453; } /* VerbatimString */
code span.wa { color: #da4453; } /* Warning */

View File

@ -1,73 +1,87 @@
/*
* Generated with:
* $ pygmentize -f html -S dracula -O classprefix=py- -a .highlight
*/
pre { line-height: 125%; } pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .normal { color: #f1fa8c; background-color: #44475a; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: #f1fa8c; background-color: #44475a; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #50fa7b; background-color: #6272a4; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #50fa7b; background-color: #6272a4; padding-left: 5px; padding-right: 5px; }
.hll { background-color: #ffffcc } .highlight .hll { background-color: #44475a }
.c { color: #3D7B7B; font-style: italic } /* Comment */ .highlight { background: #282a36; color: #f8f8f2 }
.err { border: 1px solid #FF0000 } /* Error */ .highlight .py-c { color: #6272a4 } /* Comment */
.k { color: #008000; font-weight: bold } /* Keyword */ .highlight .py-err { color: #f8f8f2 } /* Error */
.o { color: #666666 } /* Operator */ .highlight .py-g { color: #f8f8f2 } /* Generic */
.ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */ .highlight .py-k { color: #ff79c6 } /* Keyword */
.cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */ .highlight .py-l { color: #f8f8f2 } /* Literal */
.cp { color: #9C6500 } /* Comment.Preproc */ .highlight .py-n { color: #f8f8f2 } /* Name */
.cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */ .highlight .py-o { color: #ff79c6 } /* Operator */
.c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */ .highlight .py-x { color: #f8f8f2 } /* Other */
.cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ .highlight .py-p { color: #f8f8f2 } /* Punctuation */
.gd { color: #A00000 } /* Generic.Deleted */ .highlight .py-ch { color: #6272a4 } /* Comment.Hashbang */
.ge { font-style: italic } /* Generic.Emph */ .highlight .py-cm { color: #6272a4 } /* Comment.Multiline */
.gr { color: #E40000 } /* Generic.Error */ .highlight .py-cp { color: #ff79c6 } /* Comment.Preproc */
.gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .py-cpf { color: #6272a4 } /* Comment.PreprocFile */
.gi { color: #008400 } /* Generic.Inserted */ .highlight .py-c1 { color: #6272a4 } /* Comment.Single */
.go { color: #717171 } /* Generic.Output */ .highlight .py-cs { color: #6272a4 } /* Comment.Special */
.gp { color: #000080; font-weight: bold } /* Generic.Prompt */ .highlight .py-gd { color: #8b080b } /* Generic.Deleted */
.gs { font-weight: bold } /* Generic.Strong */ .highlight .py-ge { color: #f8f8f2; text-decoration: underline } /* Generic.Emph */
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .py-gr { color: #f8f8f2 } /* Generic.Error */
.gt { color: #0044DD } /* Generic.Traceback */ .highlight .py-gh { color: #f8f8f2; font-weight: bold } /* Generic.Heading */
.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ .highlight .py-gi { color: #f8f8f2; font-weight: bold } /* Generic.Inserted */
.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ .highlight .py-go { color: #44475a } /* Generic.Output */
.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ .highlight .py-gp { color: #f8f8f2 } /* Generic.Prompt */
.kp { color: #008000 } /* Keyword.Pseudo */ .highlight .py-gs { color: #f8f8f2 } /* Generic.Strong */
.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ .highlight .py-gu { color: #f8f8f2; font-weight: bold } /* Generic.Subheading */
.kt { color: #B00040 } /* Keyword.Type */ .highlight .py-gt { color: #f8f8f2 } /* Generic.Traceback */
.m { color: #666666 } /* Literal.Number */ .highlight .py-kc { color: #ff79c6 } /* Keyword.Constant */
.s { color: #BA2121 } /* Literal.String */ .highlight .py-kd { color: #8be9fd; font-style: italic } /* Keyword.Declaration */
.na { color: #687822 } /* Name.Attribute */ .highlight .py-kn { color: #ff79c6 } /* Keyword.Namespace */
.nb { color: #008000 } /* Name.Builtin */ .highlight .py-kp { color: #ff79c6 } /* Keyword.Pseudo */
.nc { color: #0000FF; font-weight: bold } /* Name.Class */ .highlight .py-kr { color: #ff79c6 } /* Keyword.Reserved */
.no { color: #880000 } /* Name.Constant */ .highlight .py-kt { color: #8be9fd } /* Keyword.Type */
.nd { color: #AA22FF } /* Name.Decorator */ .highlight .py-ld { color: #f8f8f2 } /* Literal.Date */
.ni { color: #717171; font-weight: bold } /* Name.Entity */ .highlight .py-m { color: #ffb86c } /* Literal.Number */
.ne { color: #CB3F38; font-weight: bold } /* Name.Exception */ .highlight .py-s { color: #bd93f9 } /* Literal.String */
.nf { color: #0000FF } /* Name.Function */ .highlight .py-na { color: #50fa7b } /* Name.Attribute */
.nl { color: #767600 } /* Name.Label */ .highlight .py-nb { color: #8be9fd; font-style: italic } /* Name.Builtin */
.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ .highlight .py-nc { color: #50fa7b } /* Name.Class */
.nt { color: #008000; font-weight: bold } /* Name.Tag */ .highlight .py-no { color: #f8f8f2 } /* Name.Constant */
.nv { color: #19177C } /* Name.Variable */ .highlight .py-nd { color: #f8f8f2 } /* Name.Decorator */
.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ .highlight .py-ni { color: #f8f8f2 } /* Name.Entity */
.w { color: #bbbbbb } /* Text.Whitespace */ .highlight .py-ne { color: #f8f8f2 } /* Name.Exception */
.mb { color: #666666 } /* Literal.Number.Bin */ .highlight .py-nf { color: #50fa7b } /* Name.Function */
.mf { color: #666666 } /* Literal.Number.Float */ .highlight .py-nl { color: #8be9fd; font-style: italic } /* Name.Label */
.mh { color: #666666 } /* Literal.Number.Hex */ .highlight .py-nn { color: #f8f8f2 } /* Name.Namespace */
.mi { color: #666666 } /* Literal.Number.Integer */ .highlight .py-nx { color: #f8f8f2 } /* Name.Other */
.mo { color: #666666 } /* Literal.Number.Oct */ .highlight .py-py { color: #f8f8f2 } /* Name.Property */
.sa { color: #BA2121 } /* Literal.String.Affix */ .highlight .py-nt { color: #ff79c6 } /* Name.Tag */
.sb { color: #BA2121 } /* Literal.String.Backtick */ .highlight .py-nv { color: #8be9fd; font-style: italic } /* Name.Variable */
.sc { color: #BA2121 } /* Literal.String.Char */ .highlight .py-ow { color: #ff79c6 } /* Operator.Word */
.dl { color: #BA2121 } /* Literal.String.Delimiter */ .highlight .py-pm { color: #f8f8f2 } /* Punctuation.Marker */
.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ .highlight .py-w { color: #f8f8f2 } /* Text.Whitespace */
.s2 { color: #BA2121 } /* Literal.String.Double */ .highlight .py-mb { color: #ffb86c } /* Literal.Number.Bin */
.se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */ .highlight .py-mf { color: #ffb86c } /* Literal.Number.Float */
.sh { color: #BA2121 } /* Literal.String.Heredoc */ .highlight .py-mh { color: #ffb86c } /* Literal.Number.Hex */
.si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */ .highlight .py-mi { color: #ffb86c } /* Literal.Number.Integer */
.sx { color: #008000 } /* Literal.String.Other */ .highlight .py-mo { color: #ffb86c } /* Literal.Number.Oct */
.sr { color: #A45A77 } /* Literal.String.Regex */ .highlight .py-sa { color: #bd93f9 } /* Literal.String.Affix */
.s1 { color: #BA2121 } /* Literal.String.Single */ .highlight .py-sb { color: #bd93f9 } /* Literal.String.Backtick */
.ss { color: #19177C } /* Literal.String.Symbol */ .highlight .py-sc { color: #bd93f9 } /* Literal.String.Char */
.bp { color: #008000 } /* Name.Builtin.Pseudo */ .highlight .py-dl { color: #bd93f9 } /* Literal.String.Delimiter */
.fm { color: #0000FF } /* Name.Function.Magic */ .highlight .py-sd { color: #bd93f9 } /* Literal.String.Doc */
.vc { color: #19177C } /* Name.Variable.Class */ .highlight .py-s2 { color: #bd93f9 } /* Literal.String.Double */
.vg { color: #19177C } /* Name.Variable.Global */ .highlight .py-se { color: #bd93f9 } /* Literal.String.Escape */
.vi { color: #19177C } /* Name.Variable.Instance */ .highlight .py-sh { color: #bd93f9 } /* Literal.String.Heredoc */
.vm { color: #19177C } /* Name.Variable.Magic */ .highlight .py-si { color: #bd93f9 } /* Literal.String.Interpol */
.il { color: #666666 } /* Literal.Number.Integer.Long */ .highlight .py-sx { color: #bd93f9 } /* Literal.String.Other */
.highlight .py-sr { color: #bd93f9 } /* Literal.String.Regex */
.highlight .py-s1 { color: #bd93f9 } /* Literal.String.Single */
.highlight .py-ss { color: #bd93f9 } /* Literal.String.Symbol */
.highlight .py-bp { color: #f8f8f2; font-style: italic } /* Name.Builtin.Pseudo */
.highlight .py-fm { color: #50fa7b } /* Name.Function.Magic */
.highlight .py-vc { color: #8be9fd; font-style: italic } /* Name.Variable.Class */
.highlight .py-vg { color: #8be9fd; font-style: italic } /* Name.Variable.Global */
.highlight .py-vi { color: #8be9fd; font-style: italic } /* Name.Variable.Instance */
.highlight .py-vm { color: #8be9fd; font-style: italic } /* Name.Variable.Magic */
.highlight .py-il { color: #ffb86c } /* Literal.Number.Integer.Long */

View File

@ -7,18 +7,27 @@ return {
_with_0:close() _with_0:close()
end end
if block.classes[1] == "moon" or block.classes[1] == "moonscript" then if block.classes[1] == "moon" or block.classes[1] == "moonscript" then
local p = io.popen(("pygmentize -f html -l moonscript.py %s -x"):format(fname)) local p = io.popen(("pygmentize -f html -O style=dracula,wrapcode,classprefix=py- -l moonscript.py %s -x"):format(fname))
local out = p:read("*a") local out = p:read("*a")
p:close() p:close()
return pandoc.RawBlock("html", out) return pandoc.RawBlock("html", out)
else else
local status, handle_or_error = pcall(function() if block.classes[1] == nil or block.classes[1] == "heex" then
return io.popen(("pygmentize -f html -l %s %s"):format(block.classes[1], fname)) if block.classes[1] == nil then
end) local cb = pandoc.CodeBlock(block.text, {
local sout = handle_or_error:read("*a") class = "sourceCode"
if block.classes[1] == "heex" then })
return block return pandoc.Div(cb, {
class = "sourceCode"
})
else
return block
end
else else
local status, handle_or_error = pcall(function()
return io.popen(("pygmentize -f html -O style=dracula,wrapcode,classprefix=py- -l %s %s"):format(block.classes[1], fname))
end)
local sout = handle_or_error:read("*a")
return pandoc.RawBlock("html", sout) return pandoc.RawBlock("html", sout)
end end
end end

View File

@ -5,7 +5,7 @@ CodeBlock: (block) ->
\close! \close!
if block.classes[1] == "moon" or block.classes[1] == "moonscript" if block.classes[1] == "moon" or block.classes[1] == "moonscript"
p = io.popen ("pygmentize -f html -l moonscript.py %s -x")\format fname p = io.popen ("pygmentize -f html -O style=dracula,wrapcode,classprefix=py- -l moonscript.py %s -x")\format fname
-- p = io.open fname -- p = io.open fname
out = p\read"*a" out = p\read"*a"
@ -13,19 +13,33 @@ CodeBlock: (block) ->
pandoc.RawBlock "html", out pandoc.RawBlock "html", out
-- pandoc.RawBlock "html", "moonscript" -- pandoc.RawBlock "html", "moonscript"
else else
status, handle_or_error = pcall -> if block.classes[1] == nil or block.classes[1] == "heex"
io.popen ("pygmentize -f html -l %s %s")\format block.classes[1], fname -- pandoc.RawBlock "text", block.text
-- require("moon").p [k for k,v in pairs block]
-- tb = pandoc.RawBlock "html",
if block.classes[1] == nil
cb = pandoc.CodeBlock(block.text, class: "sourceCode")
pandoc.Div cb, class: "sourceCode"
else
block
-- pandoc.CodeBlock block.text, "text"
else
status, handle_or_error = pcall ->
io.popen ("pygmentize -f html -O style=dracula,wrapcode,classprefix=py- -l %s %s")\format block.classes[1], fname
-- io.open fname -- io.open fname
sout = handle_or_error\read"*a" sout = handle_or_error\read"*a"
-- handle_or_error\close! -- handle_or_error\close!
-- if sout\len! == 0 then block else pandoc.RawBlock "html", sout -- if sout\len! == 0 then block else pandoc.RawBlock "html", sout
if block.classes[1] == "heex" -- if mat = sout\match('<div class="highlight"><pre>(.-)\n?</pre></div>')
-- pandoc.RawBlock "html", "heex" -- rep = '<div class="sourceCode"><pre class="sourceCode ' .. block.classes[1] .. '"><code class="sourceCode ' .. block.classes[1] .. '">' .. mat .. '</code></pre></div>'
block -- sout = sout\gsub('<div class="highlight"><pre>(.-)\n?</pre></div>', rep)
else
pandoc.RawBlock "html", sout pandoc.RawBlock "html", sout
-- if mat = out\match('<div class="highlight"><pre>(.-)\n?</pre></div>')
-- rep = '<div class="sourceCode"><pre class="sourceCode ' .. 'moonscript"><code class="sourceCode ' .. 'moonscript">' .. mat .. '</code></pre></div>'
-- out = out\gsub('<div class="highlight"><pre>(.-)\n?</pre></div>', rep)
-- p = io.open fname -- p = io.open fname
-- out = p\read"*a" -- out = p\read"*a"

View File

@ -120,16 +120,18 @@ sitegen.create =>
} for path in *files } for path in *files
add "index.html", title: "Catalin Mititiuc" add "index.html", title: "Catalin Mititiuc"
-- add "blog.html", title: "Posts", target: "posts/index", template: "blog" add "blog.html", title: "Posts", target: "posts/index", template: "blog"
add "code.md", add "code.md",
template: "post" template: "post"
title: "Code Syntax Highlight Samples" title: "Code Syntax Highlight Samples"
publish_date: format_date date true publish_date: format_date date true
-- add_all files_from "docs" add_all files_from "docs"
copy "app.css" copy "app.css"
copy "moonscript.css" copy "moonscript.css"
copy "pygments.css" copy "pygments.css"
copy "pandoc.css"
copy "pandoc-old.css"
-- replace post markdown yaml headers with moonscript headers -- replace post markdown yaml headers with moonscript headers
filter "docs", (body) => filter "docs", (body) =>

View File

@ -11,8 +11,9 @@
type="text/css" type="text/css"
media="screen" media="screen"
/> />
<link rel="stylesheet" href="$root/pandoc.css?$generate_date" />
<link rel="stylesheet" href="$root/pygments.css?$generate_date" />
<link rel="stylesheet" href="$root/app.css?$generate_date" /> <link rel="stylesheet" href="$root/app.css?$generate_date" />
<link rel="stylesheet" href="$root/moonscript.css?$generate_date" />
</head> </head>
<body class="bg-white"> <body class="bg-white">
<header> <header>