Support rendering to String/HTML rendering#1
Support rendering to String/HTML rendering#1Ruin0x11 wants to merge 3 commits intobestouff:masterfrom
Conversation
bestouff
left a comment
There was a problem hiding this comment.
Longer term (if ever) I'll transform all this with some kind of "themes", so there will be a colorful theme, a manpage-like theme and a plain-text theme.
For now it's good for me.
bestouff
left a comment
There was a problem hiding this comment.
To be honest I have some troubles wrapping my head around thoses changes, the whitespace diffs make them a bit difficult for me to grasp. It seems to me you have moved all the tag generation in some tag_* methods, and deferred everything inside HTML tags to html2runes. Am I right in saying that markdown-inside-HTML will not be handled correctly ?
| syntect = "1.3" | ||
| unicode-segmentation = "1.1" | ||
| unicode-width = "0.1" | ||
| html2runes = { git = "https://github.com/Ruin0x11/html2runes" } |
There was a problem hiding this comment.
Here please make a proper release and depend on it.
| // is omitted, since many docs don't have the 'rust' tag in | ||
| // code blocks | ||
| self.syntax = match self.syntaxes.find_syntax_by_token(&info) { | ||
| Some(syn) => Some(syn), |
There was a problem hiding this comment.
Nope, because I want catmark to work in the general case, where a code block from a markdown file without language should stay unhilighted. Please make that a sort-of config of the library.
| } | ||
|
|
||
| fn add_html<'a>(parent: &mut DomBox<'a>, html: Cow<'a, str>) { | ||
| let text = html2runes::html_to_text(&html.clone().to_mut()); |
There was a problem hiding this comment.
So if I understand it correctly, this will strip HTML tags completely ? Which means something like sometext won't be rendered in italics ?
This allows
catmarkto be used as a library. This will probably have to wait until the git dependency I added is merged and published to crates.io.