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: store if list is loose or not in the List #26598

Merged
merged 4 commits into from
Mar 25, 2018

Conversation

KristofferC
Copy link
Sponsor Member

Punt on updating the renders in base but do it for the Documenter HTML renderer: JuliaDocs/Documenter.jl#685

@mbauman mbauman added the docsystem The documentation building system label Mar 23, 2018
@KristofferC KristofferC changed the title use a field to determine if list is loose or not Markdown: store if list is loose or not in the List Mar 23, 2018
@mortenpi
Copy link
Contributor

Lists with multiple child blocks don't get the loose flag at the moment:

julia> Markdown.md"""
       - a
       - b

         a
       - c
       """.content
1-element Array{Any,1}:
 Markdown.List(Any[Any[Markdown.Paragraph(Any["a"])], Any[Markdown.Paragraph(Any["b"]), Markdown.Paragraph(Any["a"])], Any[Markdown.Paragraph(Any["c"])]], -1, false)

Is there anything specific holding back updating the print/show methods in Base to using the .loose flag? (I haven't looked at the code myself.)

Would you consider it a fix for #21922? Also, just for reference, #22071.

I think this is a good way to get the tight/loose lists in. Having Paragraphs wrapped around list items is actually consistent with the AST from the CommonMark sample parser. It's then up to the renderer to display the paragraphs differently based on whether the list is loose or not (as you've done in Documenter).

@KristofferC
Copy link
Sponsor Member Author

KristofferC commented Mar 23, 2018

Nothing preventing updating Base render methods but there is a need to thread a parent through every render call (like is done in Documenter) and getting Documenter output the correct HTML seems like the most important thing. I will fix and add a test for the bug you mentioned.

The next thing to fix is probably the terminal renderer.


List(x::AbstractVector, b::Integer) = new(x, b)
List(x::AbstractVector, b::Integer) = new(x, b, false)
Copy link
Sponsor Member Author

@KristofferC KristofferC Mar 25, 2018

Choose a reason for hiding this comment

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

Ooooooh, these two constructors below now create the List with the loose containing uninitialized memory. #24943 strikes again

@KristofferC
Copy link
Sponsor Member Author

Looks like the mac builder is trying to build gcc, presumably because some network error.

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

Successfully merging this pull request may close these issues.

3 participants