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

Add support for markdown in TUI, console, clipboard using pypandoc library #425

Closed
wants to merge 8 commits into from

Conversation

danschwarz
Copy link
Collaborator

@danschwarz danschwarz commented Nov 26, 2023

As it turns out, the pandoc utility, with pypandoc Python bindings, do a better job converting HTML to markdown than html2text or markdownify libraries. Pandoc is widely used and maintained, in contrast to the other libraries.

In the TUI, statuses are rendered in HTML by urwidgets if available, fallback is markdown (via pandoc if available), and finally plaintext if neither urwidgets nor pandoc are available.

In the console and clipboard, status rendering is in markdown via pandoc, fallback to plaintext if pandoc is not available.

TODO:

  1. Command line option or config file option to choose tui status rendering: HTML, markdown, or plaintext.
  2. Command line option or config file option to choose console status rendering: markdown or plaintext.
  3. Test cases to exercise all three rendering options correctly. At present, test_console.py (correctly) complains because statuses rendered as markdown do not match the expected plaintext rendering.

Here's an example of markdown rendering in the TUI. This is using github-flavored-markdown, FWIW.

This addresses issue #416 .

image

@danschwarz
Copy link
Collaborator Author

something is wrong with the code in this PR. fixing.

@danschwarz danschwarz closed this Nov 26, 2023
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.

1 participant