Skip to content
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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])
* Add file information to the printed message for mdparser problems ([#2793], [#2752])

### Fixed

Expand Down Expand Up @@ -2170,6 +2171,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 @@ -2178,6 +2180,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
[JuliaLang/julia#36953]: https://github.com/JuliaLang/julia/issues/36953
[JuliaLang/julia#38054]: https://github.com/JuliaLang/julia/issues/38054
[JuliaLang/julia#39841]: https://github.com/JuliaLang/julia/issues/39841
Expand Down
5 changes: 3 additions & 2 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 @@ -2443,7 +2443,8 @@ function domify(dctx::DCtx, ::Node, e::MarkdownAST.JuliaValue)

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 on the page $(locrepr(dctx.navnode.page)), with parent $(dctx.navnode.parent), and we
were given the value:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaruni96 PR #2803 is now merged. Can you please resolve the conflicts in CHANGELOG.md and then try this:

Suggested change
This is on the page $(locrepr(dctx.navnode.page)), with parent $(dctx.navnode.parent), and we
were given the value:
This is in file $(locrepr(dctx)), and we were given the value:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing docs before src is to be expected, given that Oscar's docs/make.jl does this:

  cd(joinpath(oscardir, "docs")) do
    ...
    makedocs(;
    ...
  end

and the file names/paths we print are relative to the current working directory.

I am not sure why Oscar does that, it would be nice if we could get rid of it, but that's for another day.

Copy link
Contributor Author

@aaruni96 aaruni96 Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then try this:

This doesn't work, complains about wrong data types. I tried monkey patching a few things hoping its a trivial error, but I couldn't make any headway (just more and different errors).

The error I get is

ERROR: FieldError: type Documenter.HTMLWriter.HTMLContext has no field `page`, available fields: `doc`, `settings`, `scripts`, `documenter_js`, `themeswap_js`, `warner_js`, `search_index`, `search_index_js`, `search_navnode`, `atexample_warnings`
Stacktrace:
  [1] getproperty
    @ ./Base_compiler.jl:54 [inlined]
  [2] locrepr(dctx::Documenter.HTMLWriter.DCtx, lines::Nothing)
    @ Documenter.HTMLWriter ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:715
  [3] locrepr(dctx::Documenter.HTMLWriter.DCtx)
    @ Documenter.HTMLWriter ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:713
  [4] domify(dctx::Documenter.HTMLWriter.DCtx, ::MarkdownAST.Node{Nothing}, e::MarkdownAST.JuliaValue)
    @ Documenter.HTMLWriter ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:2446
  [5] domify(dctx::Documenter.HTMLWriter.DCtx, node::MarkdownAST.Node{Nothing})
    @ Documenter.HTMLWriter ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:1813
  [6] #domify##2
    @ ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:1816 [inlined]
...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh. Seems my previous PR did not have enough coverage to reveal that I messed up... Try applying this patch in addition:

diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl
index 6868a874c..2803165fd 100644
--- a/src/html/HTMLWriter.jl
+++ b/src/html/HTMLWriter.jl
@@ -710,9 +710,7 @@ struct DCtx
 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)
+    return Documenter.locrepr(dctx.ctx.doc, dctx.navnode.page, lines)
 end
 
 function SearchRecord(ctx::HTMLContext, navnode; fragment = "", title = nothing, category = "page", text = "")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without trying it now, relying on my memory of attempting something like this during my "monkey patching", I expect this to not work because dctx.navnode.page is a string, but locrepr expects something of type ::Page.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, my patch is patching the locrepr method I added earlier today. It had a merge conflict which I resolved incorrectly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After applying your patch, I still get the error I predicted :

ERROR: FieldError: type String has no field `source`; String has no fields at all.
Stacktrace:
  [1] getproperty
    @ ./Base_compiler.jl:54 [inlined]
  [2] locrepr(doc::Documenter.Document, page::String, lines::Nothing)
    @ Documenter ~/Programs/git/GitHub/Documenter.jl/src/utilities/utilities.jl:84
  [3] locrepr(dctx::Documenter.HTMLWriter.DCtx, lines::Nothing)
    @ Documenter.HTMLWriter ~/Programs/git/GitHub/Documenter.jl/src/html/HTMLWriter.jl:713

The locrepr method in utilities.jl doesn't specify needing the second argument as a ::Page, but assumes it, and tries accessing the field source.


`$(e.ref)` which is of type `$(typeof(e.ref))`
"""
Expand Down
2 changes: 1 addition & 1 deletion src/latex/LaTeXWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ function latex(io::Context, node::Node, value::MarkdownAST.JuliaValue)

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

We don't have the file or line number available, but we got given the value:
We have the file name $(io.filename), and we were given the value:

`$(value.ref)` which is of type `$(typeof(value.ref))`
"""
Expand Down
Loading