How can I customize code block? #114
Unanswered
TetraTheta
asked this question in
Q&A
Replies: 2 comments
-
|
Have you tried the parameters?
Expand works only on code lines is over than the max lines, there is example on the docs site...... |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
If you want to specify parameters for particular code block, there is I don't have plan to implement this for other parameters, you can read the implementation of data-max-lines and inspired from it, and then create a PR. ```text {data-max-lines=3}
LINE 1
LINE 2
LINE 3
LINE 4
``` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
By default, this code will create un-wrapped code block that has horizontal scroll bar.
code-block-panelmodule convert this Markdown code into beautiful HTML code like this:But writer cannot decide the default appearance of this code block, like whether display line number or whether wrap the content of the code block, etc.
The official documentation didn't mention about it neither.
If user clicks 'Line Number' button (first one), it will add
code-no-lnclass to thediv pre code.If user clicks 'Wrap Code' button (second one), it will add
code-wrapclass to thediv pre code.I don't know what the 'Expand' button (third one) does. It looks like it does nothing on my side.
I want to pre-define these in Markdown, like this:
If it works as I want, this code block won't display line number and wrap the content.
But using
plaintext {.code-wrap .code-no-ln}only adds.code-wrap .code-no-lnto the<div class="highlight">like<div class="highlight code-wrap code-no-ln">.The added class won't affect code block inside of it.
There is no way to pass these classes to
div pre code.How can I customize the default look of the code block, via Markdown?
I might be able to create Javascript or Post-processor that automatically 'relays' class of
divtodiv pre code, but that doesn't look intuitive to me.Beta Was this translation helpful? Give feedback.
All reactions