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

Markdown.Paragraph might not contain an array #1708

Open
krrutkow opened this issue Oct 10, 2021 · 3 comments
Open

Markdown.Paragraph might not contain an array #1708

krrutkow opened this issue Oct 10, 2021 · 3 comments

Comments

@krrutkow
Copy link

In reference to analytech-solutions/CBinding.jl#89

Documenter doesn't accept Markdown.Paragraph(Markdown.Link(...)) even though it renders in the REPL help mode correctly. It seems that the contents of the paragraph are assumed to be an array, but there is no type restriction on the field to enforce that. Indeed, Documenter works when making a change to meet that assumption (Markdown.Paragraph([Markdown.Link(...)]).

@mortenpi mortenpi added Type: Bug Status: Speculative It's unknown if this is something that we wan't to do and removed Status: Speculative It's unknown if this is something that we wan't to do labels Mar 26, 2022
@mortenpi
Copy link
Member

The Markdown AST generated by CBinding.jl is, by some definition, invalid. I don't think the parser ever generates AST where the children would not be wrapped in a Vector. So ideally I think the generated AST should be fixed.

But you're right in that the Markdown types do not enforce that, and I don't think we should throw an error here, although we could print a warning. The offending method that would need some sort of a fix is here:

_convert_block(b::Markdown.Paragraph) = Paragraph(_convert_inline(b.content))

@krrutkow
Copy link
Author

krrutkow commented Mar 26, 2022

I don't think we should throw an error here, although we could print a warning.

Better yet might be to silently "promote" it to a 1-element Vector if it is not already a Vector.

It appears that something similar is already being done in other situations:

nodes = isa(text, AbstractVector) ? text : [text]

@fleimgruber
Copy link

fleimgruber commented Oct 4, 2023

@mortenpi I tested this again with Documenter v1.1.0, seeing a similar traceback as before, see analytech-solutions/CBinding.jl#89 (comment). I think it is related, but not the same error?

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

No branches or pull requests

3 participants