Skip to content

Support rendering to String/HTML rendering#1

Open
Ruin0x11 wants to merge 3 commits intobestouff:masterfrom
Ruin0x11:support_html_rendering
Open

Support rendering to String/HTML rendering#1
Ruin0x11 wants to merge 3 commits intobestouff:masterfrom
Ruin0x11:support_html_rendering

Conversation

@Ruin0x11
Copy link
Copy Markdown

@Ruin0x11 Ruin0x11 commented Jul 4, 2017

This allows catmark to be used as a library. This will probably have to wait until the git dependency I added is merged and published to crates.io.

Copy link
Copy Markdown
Owner

@bestouff bestouff left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Owner

@bestouff bestouff left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Copy Markdown
Owner

@bestouff bestouff left a comment

Choose a reason for hiding this comment

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

I'd prefer not to depend on a github link, but on a proper crates.io release. For other remarks see inline your commit.
EDIT: sorry you did already mention the github-to-crates.io thing. Plus I messed my review and made a second one.

Copy link
Copy Markdown
Owner

@bestouff bestouff left a comment

Choose a reason for hiding this comment

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

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" }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

So if I understand it correctly, this will strip HTML tags completely ? Which means something like sometext won't be rendered in italics ?

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.

2 participants