MultiMarkdown-6 icon indicating copy to clipboard operation
MultiMarkdown-6 copied to clipboard

Referencable codeblocks

Open tux-mind opened this issue 7 years ago • 1 comments

Hi, first of all, thank you for this project, it is a great tool to save precious time.

I would like to ask a new feature: referencable fenced code blocks.

When a fenced code block is translated into latex, it has neither a caption nor a label.

I solved this by using this hack, which includes those two latex parameters into the lstlisting command arguments:

\```Ruby,label={such_code},caption={Very\,listing}
puts("WOW")
\```

backslash are needed to escape GitHub markdown fenced code blocks. \, inserts a space in latex, as whitespace would stop the parsing of the code language

You can reference the code using [](#such_code).

I hope that this helps, best regards, tux_mind.

tux-mind avatar Jun 19 '18 17:06 tux-mind

I'll have to think about this one. I'm not sure it directly translates into HTML, and I worry about overloading the fenced code block syntax too much.

I'll leave this open for anyone else to comment if they choose.

fletcher avatar Jun 20 '18 16:06 fletcher