fix(codeblock): pass through the options of chroma (#715)

* fix(codeblock): pass through the options of chroma

Pass through the options of chroma highlighting processing for whom
may use some options in codeblock.

This commit fix problem with the following scenarios:
```python {linenos=true}
print("Hello World")
```

Signed-off-by: cubercsl <2014cais01@gmail.com>

* fix(codeblock): margin of no highlight codeblock

This commit fix the wrong margin value of the codeblock which
can not highlight.

The margin is now use the value of ".article-content pre"

Signed-off-by: cubercsl <2014cais01@gmail.com>

Signed-off-by: cubercsl <2014cais01@gmail.com>
This commit is contained in:
cubercsl 2022-12-03 20:14:37 +08:00 committed by GitHub
parent 2035beb5a0
commit 21bd04ec89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -342,6 +342,10 @@
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
} }
pre {
margin: 0;
}
} }
.table-wrapper { .table-wrapper {

View File

@ -13,7 +13,7 @@
</header> </header>
<code id="codeblock-id-{{ .Ordinal }}" style="display:none;">{{- .Inner -}}</code> <code id="codeblock-id-{{ .Ordinal }}" style="display:none;">{{- .Inner -}}</code>
{{- if transform.CanHighlight $lang -}} {{- if transform.CanHighlight $lang -}}
<div class="{{ $class }}">{{- highlight .Inner $lang -}}</div> <div class="{{ $class }}">{{- highlight .Inner $lang .Options -}}</div>
{{- else -}} {{- else -}}
<pre><code class="{{ $class }}">{{- .Inner -}}</code></pre> <pre><code class="{{ $class }}">{{- .Inner -}}</code></pre>
{{- end -}} {{- end -}}