Skip to content

Replace markdown library to fix nested lists rendering (#2217) - #2515

Merged
AucaCoyan merged 3 commits into
espanso:devfrom
gcailly:fix-markdown-nested-lists-2217
Oct 11, 2025
Merged

AucaCoyan merged 3 commits into
espanso:devfrom
gcailly:fix-markdown-nested-lists-2217

Conversation

@gcailly

@gcailly gcailly commented Oct 6, 2025 •

Copy link
Copy Markdown
Contributor

This PR replaces the markdown 0.3.0 library with pulldown-cmark 0.13.0 to fix #2217, where nested lists were generating excessive <p> tags inside <li> elements.

It may fix #759, fix #818, fix #1294,
and possibly #1613, and #2114.

I did not test it for real, only with unit tests.

🚨 I'm not sure if changing a core dependency is appropriate here... I'm trying to do my best with these contributions, so please don't hesitate to tell me if I'm going in the wrong direction. 🙂

…panso#2483)

When running commands like `espanso service --help` or `espanso package --help`,
the CLI was displaying the main application help instead of the specific
subcommand help.

This was caused by using `clap_instance.print_help()` which always prints
the root command help, instead of using `err.exit()` which properly handles
contextual help for subcommands.

Fix: Use `err.exit()` to let Clap handle contextual help display.

Fixes espanso#2483
Replace markdown 0.3.0 with pulldown-cmark 0.13.0 to fix excessive <p> tags
in nested lists. The old markdown library was adding paragraph tags inside
list items when they contained sublists, which caused extra spacing in rich
text editors and email clients.

pulldown-cmark is CommonMark-compliant and correctly handles tight lists
(no blank lines between items) by not adding <p> tags inside <li> elements.

This also eliminates the need for catch_unwind protection since pulldown-cmark
doesn't panic on malformed markdown, unlike the old library (see espanso#759).

Fixes espanso#2217
@gcailly
gcailly requested a review from AucaCoyan as a code owner October 6, 2025 13:09
@AucaCoyan

Copy link
Copy Markdown
Collaborator

I'm not sure if changing a core dependency is appropriate here

That's allright! We need to discuss and test things before implement them 😊 .

Out of time for today, I'll test this tomorrow! Not sure if I'm going to cut it for the release, but at least I'll know where is at

@AucaCoyan

AucaCoyan commented Oct 11, 2025 •

Copy link
Copy Markdown
Collaborator

It does solve:
#759, #818 , #1294 and #2217

but doesn't solve
#1613,
It's related to footnotes with brakets

see my [linked source]

[linked source]: www.google.com

and #2114.

that is somewhat similar, it's about urls with parenthesis (( and ))

Nevertheless it advances the issues a lot! I like pulldown-cmark much better than the markdown dependency.

Thanks again for this big PR!

@AucaCoyan
AucaCoyan merged commit 4abfe46 into espanso:dev Oct 11, 2025
sboldt1978 pushed a commit to sboldt1978/espanso that referenced this pull request Feb 11, 2026
…espanso#2515)

* Fix markdown rendering with nested lists (espanso#2217)

Replace markdown 0.3.0 with pulldown-cmark 0.13.0 to fix excessive <p> tags
in nested lists. The old markdown library was adding paragraph tags inside
list items when they contained sublists, which caused extra spacing in rich
text editors and email clients.

pulldown-cmark is CommonMark-compliant and correctly handles tight lists
(no blank lines between items) by not adding <p> tags inside <li> elements.

This also eliminates the need for catch_unwind protection since pulldown-cmark
doesn't panic on malformed markdown, unlike the old library (see espanso#759).

Fixes espanso#2217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants