pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

minted: Fix inline code when it contains special characters. #43

Closed QuLogic closed 5 years ago

QuLogic commented 5 years ago

If an inline code section contains an unmatched brace, then using braces as the \mintinline delimiter breaks. The inline section will extend to the next matching brace instead.

\mintinline can use any other character for a delimiter, so try to switch to something else when braces are in the text.

Fixes #42.

QuLogic commented 5 years ago

Oops, the code I put into the sample.md doesn't demonstrate the bug; fixed.

QuLogic commented 5 years ago

I also just noticed that no_mintinline can break with certain inputs; I've got a partial patch for that right now.

svenevs commented 5 years ago

@QuLogic this is awesome -- you're fixes here are great! Sorry for not seeing this until now.

I added a follow-up PR #44 to clarify the impact of leaving Code elements in tact rather than returning \texttt commands. I love the improvements you made to this filter, and to be extra clear returning the unchanged element back to pandoc is a great decision -- the filter doesn't need to know how / what to escape for special characters :heart: That PR is just documenting / testing the impact of --no-highlight.

QuLogic commented 5 years ago

Thanks!

Though actually that bit was @tarleb's idea.