From 21bd04ec89281a7beebe64792b45d52be38f07ef Mon Sep 17 00:00:00 2001 From: cubercsl <2014cais01@gmail.com> Date: Sat, 3 Dec 2022 20:14:37 +0800 Subject: [PATCH] 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> --- assets/scss/partials/layout/article.scss | 4 ++++ layouts/_default/_markup/render-codeblock.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index ba06c11..3f1fd5f 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -342,6 +342,10 @@ font-size: 14px; font-weight: bold; } + + pre { + margin: 0; + } } .table-wrapper { diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html index 21c5100..f9f077e 100644 --- a/layouts/_default/_markup/render-codeblock.html +++ b/layouts/_default/_markup/render-codeblock.html @@ -13,7 +13,7 @@ {{- if transform.CanHighlight $lang -}} -
{{- highlight .Inner $lang -}}
+
{{- highlight .Inner $lang .Options -}}
{{- else -}}
{{- .Inner -}}
{{- end -}}