Skip to content

feature: Preview ordered lists in normal mode #250

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

Closed
mfbehrens opened this issue Dec 5, 2024 · 1 comment
Closed

feature: Preview ordered lists in normal mode #250

mfbehrens opened this issue Dec 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mfbehrens
Copy link

Is your feature request related to a problem? Please describe.

In Markdown, it is common to write ordered lists as

1. first element
1. second element
1. third element

which is correctly rendering to:

  1. first element
  2. second element
  3. third element

e.g. see markdownguide.org

render-markdown.nvim unfortunately does not render this in normal mode.

Describe the solution you'd like

When I exit edit mode and look at the document in normal mode, all numbers are corrected to their actual number.

Describe alternatives you've considered

Use the markdown preview in the browser

Additional information

No response

@mfbehrens mfbehrens added the enhancement New feature or request label Dec 5, 2024
@mfbehrens mfbehrens changed the title feature: Render unordered lists feature: Preview ordered lists in normal mode Dec 5, 2024
MeanderingProgrammer added a commit that referenced this issue Dec 6, 2024
## Details

Request: #250

Previously we supported adding icons for ordered lists in much the same
way as unordered, however by default the value was empty.

To do an auto ordering for the pattern of using `1.` for every value we
now provide a default value. However, because ordered lists can go on
and we want to support arbitrary lengths we now also support setting a
function for both ordered and unordered list icons. The function is
called with both the level of the list and the index of the item and
whatever value is returned is used as the icon.

The default function just concatenates a period after the index value
and ignores the level.
@MeanderingProgrammer
Copy link
Owner

There was a way to do this, it just wasn't enabled by default. You would do something like:

require('render-markdown').setup({
  bullet = {
    ordered_icons = { { '1', '2', '3', '4', '5', '6', ... } },
  },
})

However doing this for long lists would be tedious so I added support for functions to be the value along with a default implementation that probably does what you were looking for here: a7097f3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants