LuxDL / DocumenterVitepress.jl

Documentation with Documenter.jl and VitePress
https://luxdl.github.io/DocumenterVitepress.jl/
MIT License
62 stars 9 forks source link

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

Open dom-linkevicius opened 1 month ago

dom-linkevicius commented 1 month ago

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 commented 3 weeks ago

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 4) zxcv 4) hgdd
asinghvi17 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 1 week ago

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 commented 1 week ago

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