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

✨ Render Rich markup as HTML in Markdown docs #847

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

svlandeg
Copy link
Member

@svlandeg svlandeg commented May 28, 2024

Fixes #819: ensure that Rich-formatted help texts get rendered properly in Markdown by using the Rich built-in export_html functionality.

I've expanded the example from #819 to ensure that the following are covered: Command help, Option help, Argument help, default value, [required] flag.

TODO

Double check whether existing functionality and printing behaviour has remained unchanged.

@svlandeg svlandeg added feature New feature, enhancement or request p3 labels May 28, 2024
@svlandeg svlandeg marked this pull request as ready for review May 28, 2024 17:58
Comment on lines +365 to +367
if rich is not None:
# This is needed for when we want to export to HTML
extra_str = rich.markup.escape(extra_str).strip()
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only bit that worries me a bit (here and L559) as this changes core functionality anytime get_help_record is called on an argument or an option. Existing tests initially failed in test_doc.py but I was able to remedy those by using highlight=False, overflow="ignore" and crop=False in the rich_to_html helper function.

Nevertheless @tiangolo, it would be good to get your eyes on this 🙏

@svlandeg svlandeg changed the title ✨ Render Rich markup as HTML in Markdown docs ✨ Render Rich markup as HTML in Markdown docs Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request p3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rich markup in generated Markdown docs
1 participant