Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Documenter 1.0? #11

Open
fingolfin opened this issue Sep 29, 2023 · 13 comments
Open

Support for Documenter 1.0? #11

fingolfin opened this issue Sep 29, 2023 · 13 comments

Comments

@fingolfin
Copy link
Contributor

Are there plans to update this package for Documenter 1.0?

@mortenpi
Copy link
Member

mortenpi commented Oct 3, 2023

Good question. And the answer is not by me. So this package is very much looking for a maintainer, preferably someone who is actually using the Markdown backend 🙂

@fingolfin
Copy link
Contributor Author

Makes sense. I am not using it myself, but I think @thofma is using it for Hecke.jl... though I am not sure he is interested in taking over DocumenterMarkdown for that, maybe he'll rather switch to plain Documenter.jl, dunno shrug

@thofma
Copy link

thofma commented Oct 3, 2023

I am not the only one! I will have a look.

@lazarusA
Copy link

lazarusA commented Oct 6, 2023

I had been trying to get it to work for a similar writer, but I just can see how to go beyond this line:

node = page.mapping[elem]

since now, mapping is gone. And where in the latest version, elem has the form

elem = Markdown.code("...", "")

with fields code and language. However,

render(io, mime, node, page, doc)

expects node to be some kinda of Node, i.e. RawNode, DocsNode etc. Any hints on how to convert that elem to a node?

@thofma
Copy link

thofma commented Oct 6, 2023

Haha, we made it to the same point. Maybe I should push my progress somewhere.

@mortenpi
Copy link
Member

I think you just need to loop over over the child nodes of the page (.children of the MarkdownAST.Node object)? The corresponding line the LaTeXWriter is here I think https://github.com/JuliaDocs/Documenter.jl/blob/dad1a4d3d4e07e0bb3eb464111f178d3da9dfa3a/src/latex/LaTeXWriter.jl#L126C37-L126C37

@lazarusA
Copy link

@mortenpi any luck?

@mortenpi
Copy link
Member

@lazarusA I didn't actually try to port the code. I was just suggesting that you can take a look at LaTeXWriter to see how you might be able to make it work.

@sylvaticus
Copy link

I am another one that use it for my Julia/ML course to produce md that I then further process toward PDF using MarkdownPP.

Just realised that DocumenterMarkdown blocks newer Documenter version... any alternative you suggest to make a single PDF from a mix of .jl/ .md source files ? (I use the two together because for mostly theoretical pages I write them directly in .md format with Julia code chunks and then use Documenter, for more coding pages I use .jl and then Literate)

@thofma
Copy link

thofma commented Jan 5, 2024

OK, I looked at this more closely, trying to follow the #11 (comment). I am still a bit puzzled. I have a page p:

julia> typeof(p)
Documenter.Page

Now I look at the children of the p.mdast (as in the LaTeXWriter.jl).

julia> c = first(p.mdast.children)
@ast Documenter.AnchoredHeader([...]) do
  MarkdownAST.Heading(1) do
    MarkdownAST.Text("Testing")
  end
end

I poked at this some more, but could not find anything useful to pass to the render function. More precisely, we have a bunch of methods of the form

 function render(io::IO, mime::MIME"text/plain", node::Documenter.DocsNode, page, doc)

and

function render(io::IO, mime::MIME"text/plain", node::Documenter.EvalNode, page, doc)

But I have not found anything Node like in p.mdast.children.

I think there is a big understanding on my part. Where are those Node thingies hidden? Or do we have to adjust the render methods to accept the MarkdownAST.NodeChildren thingies? Do you have some more breadcrumbs left @mortenpi?

@mortenpi
Copy link
Member

@thofma I'd say you should pass both the ::Node object, and also the corresponding node.element value . That is how the updated LaTeXWriter and HTMLWriter work. E.g. https://github.com/JuliaDocs/Documenter.jl/blob/deecbd7d3abc395fe31d7a393539bcda4c00d753/src/latex/LaTeXWriter.jl#L560-L563

The element object is really only there for dispatch since you can always access it via the ::Node object. But this seems like an okay way to dispatch to different implementations based on which element the node is. That said, there's also probably some other pattern that could be used to iterate over the tree.

@goerz
Copy link
Member

goerz commented Mar 28, 2024

So this package is very much looking for a maintainer

Based on #13 and his work on DocumenterVitepress, it seems like maybe @asinghvi17 would want to volunteer for that position?

@asinghvi17
Copy link

I probably don't have the bandwidth to be a full maintainer but can definitely review PRs and chip in here and there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants