You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason why I wanted a fix for preformatted blocks (#32) was that I wanted to implement syntax highlighting for code blocks for rusty-man. With the new release v0.2.1, I was able to implement basic syntax highlighting using syntect. My current implementation could still be improved: Context is very important for proper syntax highlighting, but I cannot identify the block a string with a preformatted annotation belongs to. Therefore I just assume that there is only one preformatted string per line, and that preformatted strings in adjacent lines belong to the same block. Of course, this does not hold for tables or for subsequent code blocks.
Do you think html2text could make it easier to highlight code blocks?
The text was updated successfully, but these errors were encountered:
Also, I forgot to mention: As Rust doc comments mostly contain Rust code snippets, I just use the Rust syntax for syntax highlighting. But in general, HTML classes are used to identify the appropriate syntax. It would be nice if html2text would support that – see also #27.
That sounds great - I'd definitely be interested in making it easier to do things like that, and either including syntect support in html2text (probably with a feature flag) or even better making it easier to integrate with an external highlighting crate.
If #27 were implemented I guess that means you could both have access to the class for choosing the syntax and know which block each tagged element belongs to so that would be a good start - but I'm up for improving the API in other ways to make this easier.
The reason why I wanted a fix for preformatted blocks (#32) was that I wanted to implement syntax highlighting for code blocks for
rusty-man
. With the new release v0.2.1, I was able to implement basic syntax highlighting usingsyntect
. My current implementation could still be improved: Context is very important for proper syntax highlighting, but I cannot identify the block a string with a preformatted annotation belongs to. Therefore I just assume that there is only one preformatted string per line, and that preformatted strings in adjacent lines belong to the same block. Of course, this does not hold for tables or for subsequent code blocks.Do you think
html2text
could make it easier to highlight code blocks?The text was updated successfully, but these errors were encountered: