Closed christophgockel closed 2 years ago
You could use a filter, perhaps. When you match a code block with your special attribute, your filter can add raw LaTeX blocks before and after, which redefine things or whatever...
I must admit I completely forgot to get back to this. My bad!
Thanks for the response! Using filters to essentially wrap the existing content with the additional data I need is an approach I haven't considered yet! I will give that a go, thank you!
I must admit I completely forgot to get back to this. My bad!
Thanks for the response! Using filters to essentially wrap the existing content with the additional data I need is an approach I haven't considered yet! I will give that a go, thank you!
Hello,
I searched the history and closed issues but couldn't find anything, so I thought I'd ask. Is it possible to add behaviour to pass on custom attributes of a code block to the target language?
I'm not sure myself yet how it would look like for all supported formats, but I'm currently thinking specifically from Markdown to LaTeX, I'd like to be able to define a code block like this
that should result in this LaTeX code:
But right now, it seems the only attributes that are recognised/allowed are the language classes,
.numberLines
andstartFrom
as a keyword argument. No other keyword arguments are allowed - or carried over.Being able to define additional attributes in Markdown would enable me to add custom behaviour in an additional
.tex
file to make use of these attributes. So I wanted to ask if there's a possibility to add this behaviour? I'm not really familiar with Haskel, but happy to give it a try in a PR. But I wanted to check in first.Thank you!
Update 20th April:
I guess an alternative question could also be, is there a way to achieve the output of additional attributes today already?
Or could this be implemented by wrapping the existing LaTeX writer with a custom filter (somehow), so that it could treat
CodeBlock
elements with the custom code, but leave everything else as it is? I guess the line(s) I'm looking at are specifically in file https://github.com/jgm/skylighting/blob/master/skylighting-core/src/Skylighting/Format/LaTeX.hs#L75. Where theformatLaTeXBlock
function looks into theFormatOptions
it's been given. The struggle I have with thinking of a custom filter for it, that no matter what the filter does to the AST it still depends on the LaTeX writer at the end of the day which doesn't recognise attributes it doesn't know about.