Closed jez closed 5 years ago
Have you considered disabling Pandoc's tex_math_dollars
extension for your workflow? It sounds like you probably don't want it at all (unless you happen to be using lots of financial stuff and TeX math at the same time.
$ pandoc -t markdown <<< '$30'
\$30
$ pandoc -t markdown-tex_math_dollars <<< '$30'
$30
I'm not saying that invalidates this PR, just that there might be an even better solution if you don't need math.
Thanks for the heads up. Your proposed solution doesn’t solve the issue I’m having: I find myself escaping the dollar because otherwise my entire Markdown file is mis-highlighted. As far as I can tell from skimming the docs (and reading the source) there’s no way to tell vim-pandoc-syntax to highlight a buffer assuming that I’ll be running under -f markdown-tex_math_dollars
, so escaping the dollar is the only way to get useful syntax highlighting right now.
It looks like Pandoc has logic to avoid needing to escape dollar signs when used for dollar values by looking at the context and guessing. Furthermore it looks sounds like some attempt was made to support this already in our syntax patterns (see tests/latex.pdc and comments on commit 56e8e41), but that it is evidently not guessing properly any more. It looks to me like you shouldn't need the escape at all and that a conceal shouldn't be necessary if following Pandoc's default behavior is our benchmark.
I'm not saying we couldn't also have a conceal option, but their is bug in here too.
Thanks for the contribution @jez. I've been mulling this over and poking at it a little and think that while we should actually have a proper fix for this (vis-à-vis the issue I just opened) I couldn't come up with a compelling reason to not offer a conceal for the cases where it does get used (and without expressly adding an extension the default output format of Pandoc does use the escape).
Hence I'm going to merge this and we can work on fixing the other problem separately.
When working on pandoc markdown documents that deal a lot with money, I get a bunch of lines that look like
which is somewhat annoying to look at. This patch sets up a conceal character so that
\$
conceals as$
:Commit summary
Review by commit.
Add match group to conceal \$ (fc2be56)
This is the commit that actually introduces the new behavior.
Equate pandocLaTeXInlineMath contains with pandocEscapedDollar (2701ab7)
This change just propagates the pandocEscapedDollar to work in every context where pandocLaTeXInlineMath already works.