Skip to content

Check for use of "unbalanced or un-escaped \$ in the text" much earlier #2821

@fingolfin

Description

@fingolfin

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions