-
Notifications
You must be signed in to change notification settings - Fork 15
```contents renders the header id not header content #237
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
Comments
Even when i removed the custom id (i.e just provided a regular markdown header like so: |
We might be doing an mdflatten where things should go into the rendering pipeline... |
I am guessing here?
|
That is here: DocumenterVitepress.jl/src/writer.jl Lines 549 to 571 in 503d826
and Documenter does something different in LaTeXWriter: so we should copy that. |
@asinghvi17 I am assuming we replace the latex invocations with markdown, so like the following: function render(io::IO, ::MIME"text/plain", node::Documenter.MarkdownAST.Node, contents::Documenter.ContentsNode, page, doc; kwargs...)
# Having an empty itemize block in LaTeX throws an error, so we bail early
# in that situation:
isempty(contents.elements) && (_println(io); return)
depth = 1
_println(io, "") # add empty line
for (count, path, anchor) in contents.elements
@assert length(anchor.node.children) == 1
header = first(anchor.node.children)
level = header.element.level
# Filter out header levels smaller than the requested mindepth
level = level - contents.mindepth + 1
level < 1 && continue
# If we're changing depth, we need to make sure we always print the
# correct number of \begin{itemize} and \end{itemize} statements.
if level > depth
for k in 1:(level - depth)
# if we jump by more than one level deeper we need to put empty
# \items in -- otherwise LaTeX will complain
(k >= 2) && _println(io, "- ")
_println(io, "\\t- ") # todo: fix number of tabs
depth += 1
end
elseif level < depth
for _ in 1:(depth - level)
_println(io, "")
depth -= 1
end
end
# Print the corresponding \item statement
id = _hash(Documenter.anchor_label(anchor))
_print(io, "[", id, "](")
latex(io, header.children)
_println(io, ")")
end
# print any remaining missing \end{itemize} statements
for _ in 1:depth # todo: remove this loop?
_println(io, "")
end
_println(io)
return
end |
Yeah that looks reasonable, but we should use two spaces instead of tabs. Feel free to PR, thanks!! |
thanks! Will PR in a few mins. Is the convention one space per depth? or two spaces per depth? |
Two spaces I believe (to align with |
If there is a heading such as
## [Internal structure of $\Lambda_\theta$ and $\bf Z$](@id internal-struct)
in one of the doc-pages, when this is called in a "```contents" block its rendered as follows
Ideally, the content blocks should render the header content not the id like so:

The text was updated successfully, but these errors were encountered: