Skip to content

Markdown fixes #817

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Markdown fixes #817

wants to merge 6 commits into from

Conversation

basebox-mt
Copy link

This PR contains Markdown usage samples in the documentation and the examples folder as well as some opinionated fixes to the Markdown handling itself:

  • All headings are rendered in bold font, no matter what level
  • Blockquotes are rendered in italic with a single leading > for easier soft line breaks
  • Never allows more than one blank line
  • Inserts one blank line before and after headings, code blocks, blockquotes

The parsing test has been changed to make it easier to find the failing span; it has also been extended to test the new behaviour.

pulldown-cmark seems to have a bug that always returns an empty title for links. I updated it to version 0.13 in Cargo.toml, but this unfortunately did not change this.

//! ### Examples
//!
//! ```rust
//! use cursive::utils::markup::markdown::parse;
Copy link
Owner

@gyscos gyscos Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need extern crate cursive_core as cursive;, so it really just needs cursive_core, but it looks as cursive for users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - strange though that I cannot reproduce this locally. I'll try.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to test with the markdown feature to run these

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, now I can at least reproduce

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't seem to fix it... it cannot resolve CursiveExt, and when I remove it, the compiler can't find the run() method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CursiveExt is in a different crate, this might just not be possible. If it's ok I remove the example in the doc comment. I put an Markdown example into the examples folder.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also don't need to run the cursive app (or even make one), you can focus on parsing the markdown and building the TextView

@basebox-mt
Copy link
Author

I set the example in the doc comment to "ignore" - let me know if that's ok for you or of course feel free to change.

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

Successfully merging this pull request may close these issues.

3 participants