-
Notifications
You must be signed in to change notification settings - Fork 501
Description
Currently both the HTMLWriter and LaTeXWriter contain code which print warnings of this kind:
Unexpected Julia interpolation in the Markdown. This probably means that you have an
unbalanced or un-escaped \$ in the text.
E.g. if the following is used in a Markdown file (this is the content of test/warnings/src/dollar.md):
# JuliaValue
It is possible to create pseudo-interpolations with the `Markdown` parser: $foo.
$([1 2 3; 4 5 6])
They do not get evaluated.
We used to not report any location for this; it got a bit better with PR #2793, in that now at least a file is reported. But that's not enough in general, if the source is a docstring (see PR #2820 for a test case demonstrating this: the .md file is reported as source, even though it just contains a @docs block pulling in the docstring which has the problem).
To fix this, I think we could be proactive: whenever we "import" a docstring from a source file, we know its location precisely (at least I believe so?). We could now run a little "pre-check" function, which scans for this problem, and if found, reports it immediately.
This way, not only do we get precise location info, but also the warning does not have to be implemented by each writer separately.