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

Numbered lists when each number has more than 1 line of content? #150

Open
dom-linkevicius opened this issue May 31, 2024 · 5 comments
Open

Comments

@dom-linkevicius
Copy link

dom-linkevicius commented May 31, 2024

Hi,

I am trying to create an enumerated list using DocumenterVitepress, but it's rendering not quite what I would want/expect. For example, if I do

1. qwe
2. abc
3. zxc
4. ert

it renders what it's supposed to render, i.e. a list of numbers 1-4 with the three letters. However, if I want to do something like

1. qwe
``1+1`` 
2. abc
3. zxc
4. ert

it renders (spaces between number and dot are there to prevent the github markdown kicking in which actually does what I'd want it to)
1 . qwe
$1+1$
1 . abc
2 . zxc
3 . ert

The problem is that instead of ``1+1`` I want to add ::: details containers for each item in the enumerated list, so it can't be in the same line. Am I missing something obvious on how to do it?

@dom-linkevicius
Copy link
Author

dom-linkevicius commented Jun 7, 2024

bump Just to restate the problem more succinctly: I think DocumenterVitepress.jl contains a bug where it ignores the value of the first number of a numbered list and always starts off with 1 whereas Markdown numbered lists start off with the value of the first number and ignore the values of the subsequent numbers. So if I write something like

4. abcd
$1+1$
```somecode```
5. qwer
6. zxcv
9. hgdd

I should get (w.r.t. numbering):

  1. abcd
    $1+1$
    some code
  2. qwer
  3. zxcv
  4. hgdd

but I get (w.r.t numbering):

  1. abcd
    $1+1$
    some code
  1. qwer
  2. zxcv
  3. hgdd

@asinghvi17
Copy link
Collaborator

What happens if you indent the content you want to place in the link? MarkdownAST should then pick it up as being part of the list element, not totally new text.

@dom-linkevicius
Copy link
Author

If I do

4. abcd
    $1+1$
    ```somecode```
    5. qwer
    6. zxcv
    9. hgdd

I get

  1. abcd $1+1$ somecode
  2. qwer
  3. zxcv
  4. hgdd

so they are all in the same list, but numbering still starts off not how it does in Markdown. Moreover, the indentation solution falls apart when I want to add

::: details

This is a details block.

:::

to be between 1. and 2., so something like

4. abcd

    ::: details
    This is a details block.
    :::
    
    5. qwer
    6. zxcv
    9. hgdd

(spaces above/below the details block I think are necessary otherwise the detail block doesn't work properly) then it does strange things that are not what I want. I think the main problem is that the initial number 4. is ignored and turned into 1. If setting of the initial number worked as it does in plain Markdown then this would be easy.

@dom-linkevicius
Copy link
Author

dom-linkevicius commented Jun 21, 2024

One workaround is simply to use raw HTML as follows:

```@raw html
<ol start="4">
  <li>qwe</li>
</ol>
\\```

(\\ is just to not trigger end of code block in the comment) which starts an ordered list with the number 4.

@asinghvi17
Copy link
Collaborator

Vitepress accepts HTML in Markdown, so this would be a good way to do it.

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

No branches or pull requests

2 participants