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

Paragraphs in lists are rendered as paragraphs interspersing lists #14

Closed
Aksej opened this issue Dec 9, 2021 · 2 comments
Closed

Paragraphs in lists are rendered as paragraphs interspersing lists #14

Aksej opened this issue Dec 9, 2021 · 2 comments

Comments

@Aksej
Copy link

Aksej commented Dec 9, 2021

Using this docstring:

  "
 - `(REGISTER REGISTER-NAME &OPTIONAL VALUE)`

    If VALUE is not NIL, write VALUE into local register REGISTER-NAME.

    If VALUE is NIL, read the saved value from register REGISTER-NAME.

    Writing to a set register and reading from an unset register are errors.

 - `(PARTICLE INDEX)`

    Returns tha `INDEX`th particle from the particle list.

 - `PARTICLES`

    refers to the set of all particles."

the generated markdown looks like this:

   …
    - `(REGISTER REGISTER-NAME &OPTIONAL VALUE)`
    
    If VALUE is not `NIL`, write VALUE into local register `REGISTER-NAME`.
    
    If VALUE is `NIL`, read the saved value from register `REGISTER-NAME`.
    
    Writing to a set register and reading from an unset register are errors.
    
    - `(PARTICLE INDEX)`
    
    Returns tha `INDEX`th particle from the particle list.
    
    - `PARTICLES`
    
       refers to the set of all particles.

while this is the expected output:

   …
    - `(REGISTER REGISTER-NAME &OPTIONAL VALUE)`
    
       If VALUE is not `NIL`, write VALUE into local register `REGISTER-NAME`.
    
       If VALUE is `NIL`, read the saved value from register `REGISTER-NAME`.
    
       Writing to a set register and reading from an unset register are errors.
    
    - `(PARTICLE INDEX)`
    
       Returns tha `INDEX`th particle from the particle list.
    
    - `PARTICLES`
    
       refers to the set of all particles.
@melisgl
Copy link
Owner

melisgl commented Dec 12, 2021

The short answer is that the paragraphs belonging to the list item should be indented 4 spaces in compared to the bullet, while it's only 3 spaces in your example. Long story follows.

Consider the following example, where "paragraph" is indented 4 spaces and is parsed as part of the list item:

(3bmd-grammar:parse-doc "
- bullet line

    paragraph
")
=> ((:BULLET-LIST
     (:LIST-ITEM (:PARAGRAPH "bullet" " " "line")
                 (:PARAGRAPH "paragraph"))))

Good. 3bmd tolerates the bullet being indented 1 space in:

(3bmd-grammar:parse-doc "
 - bullet line

    paragraph
")
=> ((:BULLET-LIST
     (:LIST-ITEM (:PARAGRAPH "bullet" " " "line")
                 (:PARAGRAPH "paragraph"))))

but doesn't work if the "paragraph" is indented only 3 spaces:

(3bmd-grammar:parse-doc "
- bullet line

   paragraph
")
=> ((:BULLET-LIST
     (:LIST-ITEM (:PLAIN "bullet" " " "line")))
    (:PLAIN "   " "paragraph"))

In fact, this last version is what your example ended up looking like due to how pax guesses and strips the indentation from docstrings (see https://github.com/melisgl/mgl-pax#921-indentation and https://github.com/melisgl/mgl-pax#x-28MGL-PAX-3ADOCUMENT-OBJECT-20-28METHOD-20NIL-20-28STRING-20T-29-29-29).

@Aksej
Copy link
Author

Aksej commented Dec 14, 2021

I thought indenting four times would create an inline code block, I misunderstood github markdown in that respect. Sorry for the false bug report!

@Aksej Aksej closed this as completed Dec 14, 2021
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