-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2c968b
commit e9e19a6
Showing
8 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod get_build_paths; | ||
mod get_build_state; | ||
mod parse_md; | ||
mod view; | ||
|
||
use perseus::{Html, Template}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use pulldown_cmark::{html, Options, Parser}; | ||
|
||
/// Parses the given Markdown into an HTML string. This does not perform any santizing of the resulting HTML, so only parse trusted content through here! (This is designed to be used on | ||
/// user-given strings from their Tribble configurations, which they're then serving as their own websites, so security shouldn't be a problem here.) | ||
pub fn parse_md_to_html(markdown: &str) -> String { | ||
let mut opts = Options::empty(); | ||
opts.insert(Options::ENABLE_STRIKETHROUGH); | ||
opts.insert(Options::ENABLE_TABLES); | ||
let parser = Parser::new_ext(markdown, opts); | ||
let mut html_contents = String::new(); | ||
html::push_html(&mut html_contents, parser); | ||
|
||
html_contents | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters