Skip to content
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Page category is removed from the search index and now everything is in section category. ([#2762], [#2413])
* Changed the docstring block accordions from a custom implementation to HTML details+summary tag. ([#2772], [#2773])
* Improved the search tokenizer and custom trimmer to improve search results. ([#1457], [#2114], [#2744])
* Improved several warning/error messages to (more accurately) report the location (filename, line range) in which the warning/error originated. ([#2426], [#2803], [#2809])
* Improved several warning/error messages to (more accurately) report the location (filename, line range) in which the warning/error originated. ([#2426], [#2752], [#2793], [#2803], [#2809])

### Fixed

Expand Down Expand Up @@ -2178,6 +2178,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2748]: https://github.com/JuliaDocs/Documenter.jl/issues/2748
[#2750]: https://github.com/JuliaDocs/Documenter.jl/issues/2750
[#2751]: https://github.com/JuliaDocs/Documenter.jl/issues/2751
[#2752]: https://github.com/JuliaDocs/Documenter.jl/issues/2752
[#2753]: https://github.com/JuliaDocs/Documenter.jl/issues/2753
[#2761]: https://github.com/JuliaDocs/Documenter.jl/issues/2761
[#2762]: https://github.com/JuliaDocs/Documenter.jl/issues/2762
Expand All @@ -2186,6 +2187,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2774]: https://github.com/JuliaDocs/Documenter.jl/issues/2774
[#2787]: https://github.com/JuliaDocs/Documenter.jl/issues/2787
[#2792]: https://github.com/JuliaDocs/Documenter.jl/issues/2792
[#2793]: https://github.com/JuliaDocs/Documenter.jl/issues/2793
[#2803]: https://github.com/JuliaDocs/Documenter.jl/issues/2803
[#2809]: https://github.com/JuliaDocs/Documenter.jl/issues/2809
[#2812]: https://github.com/JuliaDocs/Documenter.jl/issues/2812
Expand Down
15 changes: 8 additions & 7 deletions src/html/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ using SHA: SHA
using CodecZlib: ZlibCompressorStream
using ANSIColoredPrinters: ANSIColoredPrinters

using ..Documenter: Documenter, Default, Remotes
using ..Documenter: Documenter, Default, Remotes, locrepr
using ...JSDependencies: JSDependencies
using ...DOM: DOM, @tags
using ...MDFlatten: mdflatten
Expand Down Expand Up @@ -711,8 +711,9 @@ end

function Documenter.locrepr(dctx::DCtx, lines = nothing)
doc = dctx.ctx.doc
page = dctx.navnode.page
return Documenter.locrepr(dctx.ctx.doc, dctx.ctx.page, lines)
src = dctx.navnode.page
page = doc.blueprint.pages[src]
return Documenter.locrepr(doc, page, lines)
end

function SearchRecord(ctx::HTMLContext, navnode; fragment = "", title = nothing, category = "page", text = "")
Expand Down Expand Up @@ -2443,17 +2444,17 @@ function domify(dctx::DCtx, node::Node, t::MarkdownAST.Table)
end

function domify(dctx::DCtx, ::Node, e::MarkdownAST.JuliaValue)
message = """
message =
"""
Unexpected Julia interpolation in the Markdown. This probably means that you have an
unbalanced or un-escaped \$ in the text.

To write the dollar sign, escape it with `\\\$`

We don't have the file or line number available, but we got given the value:
This is in file $(locrepr(dctx)), and we were given the value:

`$(e.ref)` which is of type `$(typeof(e.ref))`
"""

"""
if dctx.ctx.doc.user.treat_markdown_warnings_as_error
error(message)
else
Expand Down
21 changes: 11 additions & 10 deletions src/latex/LaTeXWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -850,16 +850,17 @@ latex(io::Context, node::Node, ::Documenter.MetaNode) = _println(io, "\n")
latex(io::Context, node::Node, ::Documenter.SetupNode) = nothing

function latex(io::Context, node::Node, value::MarkdownAST.JuliaValue)
message = """
Unexpected Julia interpolation in the Markdown. This probably means that you have an unbalanced
or un-escaped \$ in the text.

To write the dollar sign, escape it with `\\\$`

We don't have the file or line number available, but we got given the value:

`$(value.ref)` which is of type `$(typeof(value.ref))`
"""
message =
"""
Unexpected Julia interpolation in the Markdown. This probably means that you have an
unbalanced or un-escaped \$ in the text.

To write the dollar sign, escape it with `\\\$`

This is in file $(io.filename), and we were given the value:

`$(value.ref)` which is of type `$(typeof(value.ref))`
"""
if io.doc.user.treat_markdown_warnings_as_error
error(message)
else
Expand Down
20 changes: 10 additions & 10 deletions test/warnings/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ julia> WarningTests.run_warnings_test("dollar")
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.
┌ Warning: Unexpected Julia interpolation in the Markdown. This probably means that you have an
unbalanced or un-escaped $ in the text.
┌ Warning: Unexpected Julia interpolation in the Markdown. This probably means that you have an
│ unbalanced or un-escaped $ in the text.
To write the dollar sign, escape it with `\$`
│ To write the dollar sign, escape it with `\$`
We don't have the file or line number available, but we got given the value:
This is in file src/dollar.md, and we were given the value:
`foo` which is of type `Symbol`
│ `foo` which is of type `Symbol`
└ @ Documenter
┌ Warning: Unexpected Julia interpolation in the Markdown. This probably means that you have an
unbalanced or un-escaped $ in the text.
┌ Warning: Unexpected Julia interpolation in the Markdown. This probably means that you have an
│ unbalanced or un-escaped $ in the text.
To write the dollar sign, escape it with `\$`
│ To write the dollar sign, escape it with `\$`
We don't have the file or line number available, but we got given the value:
This is in file src/dollar.md, and we were given the value:
`[1 2 3; 4 5 6]` which is of type `Expr`
│ `[1 2 3; 4 5 6]` which is of type `Expr`
└ @ Documenter
```
"""
Expand Down
Loading