Skip to content

Nested code blocks in numbered lists have extra whitespace #161

@SteffenDE

Description

@SteffenDE

Hey there!

While looking into phoenixframework/phoenix_live_view#3575, I found what looks like a bug in EarmarkParser:

EarmarkParser.as_ast("""
1. Test

    ```elixir
    def foo
    ```
""")

generates

{:ok,
 [
   {"ol", [],
    [
      {"li", [],
       [
         {"p", [], ["Test"], %{}},
         {"pre", [], [{"code", [{"class", "elixir"}], [" def foo"], %{}}], %{}}
       ], %{}}
    ], %{}}
 ], []}

notice the extra whitespace def foo, which prevents proper diff highlighting.

In ExDoc, one can also see the extra whitespace when selecting:
image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions