Skip to content

Markdown writer: fully customizable list markers #10479

Open
@jraygauthier

Description

@jraygauthier

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions