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

🐛 Bug: Support <tt> for code next to <code> tags #49

Closed
ljrk0 opened this issue Jul 20, 2022 · 3 comments
Closed

🐛 Bug: Support <tt> for code next to <code> tags #49

ljrk0 opened this issue Jul 20, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@ljrk0
Copy link

ljrk0 commented Jul 20, 2022

Describe the bug
Unfortunately, some sites don't use semantic markup, e.g.,
http://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/
but instead specify the font directly using tt. Since markdown draws no distinction b/w code and things simply formatted in "typewriter style", these should be recognized at well (or, at least, as a plugin).

HTML Input

<tt>Some typewriter text</tt>

Generated Markdown

Some typewriter text

Expected Markdown

`Some typewriter text`

Additional context
N/A

@ljrk0 ljrk0 added the bug Something isn't working label Jul 20, 2022
@JohannesKaufmann
Copy link
Owner

Yeah, good catch. It's probably a good idea to add support for other HTML tags. In addition to <tt> for example also <kbd>, <samp> and <var>.

Should be a pretty easy addition to the library... I will also add a test-case with that snippet for <tt> from the website that you shared.

If you find any other tags on other websites, let me know. It's always good to have a wide variety of snippets for the tests...

@ljrk0
Copy link
Author

ljrk0 commented Jul 20, 2022

Yeah, it should mostly be about adding it to the Filter expression AFAICT.

I'm currently using the linked lapwat/papeer to load all longer articles I want to read onto my e reader, so I'm sure to stumble upon other missing tags :-)

I've went ahead and added an issue tracking MathJax although that is a bit more complicated:
#50

@JohannesKaufmann
Copy link
Owner

This should now be fixed in the latest version.

Make sure to update the library by running:

go get -u github.com/JohannesKaufmann/html-to-markdown

If you encounter any other bugs, feel free to open a new issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants