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

Cycle bullets when printing nested Markdown list #55456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tecosaur
Copy link
Contributor

It's nice to visually differentiate different levels of nesting (and actually print more than one). Closes #18615.

With this markdown list as an example:

- some list
  - with nesting
  - and items
    - at many levels
  - some text
    - meaningless words
      - even more words
- yet another item
  - am I really still going?
- this is the end

It's currently printed like this:

    •  some list
       • with nesting
       • and items
       • at many levels
       • some text
       • meaningless words
       • even more words

    •  yet another item
       • am I really still going?

    •  this is the end

with this PR, it's printed like this:

    •  some list
       ➤  with nesting
       ➤  and items
          –  at many levels
       ➤  some text
          –  meaningless words
             ➤  even more words
    •  yet another item
       ➤  am I really still going?
    •  this is the end

This PR:

  • fixes the 1-limited nesting bug
  • fixes a bonus bug with non-loose nested lists getting extra newlines, and,
  • introduces depth-dependent bullets

On my end, this seems to e working well, but it would be good if people could try this out and check I haven't accidentally introduced any edge-cases.

It's nice to visually differentiate different levels of nesting.
@tecosaur tecosaur added display and printing Aesthetics and correctness of printed representations of objects. markdown labels Aug 11, 2024
@KristofferC
Copy link
Member

Maybe it is just my fonts but the second level arrows has a lot more "weight" to them and sort of overpowers all the other bullets:

Screenshot_2024-08-11-11-20-59-209_com android chrome-edit

@tecosaur
Copy link
Contributor Author

Oh that's quite different to what I see:

image

Is it worth checking if that translates to what people might see in their terminals? If there's a risk of something like your screenshot, we'll definitely want to change the bullets.

@KristofferC
Copy link
Member

(this was the github markdown rendering on an android phone FWIW)

@@ -70,15 +70,40 @@ function term(io::IO, f::Footnote, columns)
end
end

function term(io::IO, md::List, columns)
const _list_bullets = ["• ", "➤ ", "– "]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe imitate what GitHub uses?

Suggested change
const _list_bullets = ["", " ", " "]
const _list_bullets = ["", " ", "▪︎ "]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display and printing Aesthetics and correctness of printed representations of objects. markdown
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use different bullets for rendering nested markdown lists
3 participants