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 writer: fully customizable list markers #10479

Open
jraygauthier opened this issue Dec 20, 2024 · 4 comments
Open

Markdown writer: fully customizable list markers #10479

jraygauthier opened this issue Dec 20, 2024 · 4 comments

Comments

@jraygauthier
Copy link

jraygauthier commented Dec 20, 2024

Describe your proposed improvement and the problem it solves.

I would like to be able to fully customize the produced ordered and unordered list markers in Markdown output.

The UL bullet marker appear to have a solution via PR #1826. There seems to be no similar OL marker customization issue/PR tough.

The method of configuration seems to be in discussion at #5584.

Here, I am mostly interested by the spaces around the markers. Could pandoc provide a way to customize those? A couple of potential approaches:

  • bullet_before, bullet_total (applicable to both UL and OL, potential fallback if UL/OL specific option not provided)
  • ul_bullet_before, ul_bullet_total, ol_bullet_before, ol_bullet_total (preferred)
  • ul_bullet_before, ul_bullet_total, ol_bullet_before, ol_bullet_total
  • ul_bullet_before, ul_bullet_after, ol_bullet_before, ol_bullet_after
  • *_single_* vs *_multi_* variants useful? Like https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md030.md.
  • Could existing --tab-stop option (which currently does not appear to have any bearing on lists' style) be reused alongside with *bullet_before?

For the OL bullet marker, I assume one could pick between 1. and #. (extension needed).

This would allow me to use pandoc to format / prettify the markdown files I work with. The current hardcoded choice does not match my preferred style. As I use lists a lot, this is quite annoying which prevents me from using pandoc as my auto formatter (or any other tool by the way as none appear to provide this feature).

Desired result (Test.md, 1 space before markers, within a total of 4 space width):

# Test

 -  Unordered A.

    Text block.

 -  Unordered B.

    Text block.

 1. Ordered A.

    Text block.

 2. Ordered B.

    Text block.

Current pandoc markdown output (close to desired, but not quite there, no space before the marker):

$ pandoc Test.md --to markdown
# Test

-   Unordered A.

    Text block.

-   Unordered B.

    Text block.

1.  Ordered A.

    Text block.

2.  Ordered B.

    Text block.

Current commonmark markdown output (this one is oddly inconsistent in between ol an ul and doesn't appear to be influenced by --tab-stop):

$ pandoc Test.md --to commonmark
# Test

- Unordered A.

  Text block.

- Unordered B.

  Text block.

1.  Ordered A.

    Text block.

2.  Ordered B.

    Text block.
@jgm
Copy link
Owner

jgm commented Dec 20, 2024

I'm reluctant to go down this path. There are ever so many choices that might be made in rendering markdown, and everyone has their own stylistic preferences. Allowing this to be configurable would add a lot of code complexity (hence also bugs and maintenance time).

@jgm
Copy link
Owner

jgm commented Dec 20, 2024

For some other examples of similar requests:

@jgm
Copy link
Owner

jgm commented Dec 20, 2024

Either we ignore all such requests, or we provide a way to address them all. This would probably involve a config file as in #5584. But then I can imagine similar requests for other formats, e.g. RST. The complexity starts to get out of hand.

@jraygauthier
Copy link
Author

I can understand your reluctance, pandoc is already a pretty large and complex piece of software. At least, the issue has been filed. I wanted to make sure this aspect was mentioned for completeness were you to go forward with #5584 😃.

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

2 participants