Add Rust preprocessor to handle code examples gracefully

Fixes #213
This commit is contained in:
Sebastian Thiel
2019-07-05 17:00:56 +08:00
parent 8cb73d66c2
commit f33fae47e9
11 changed files with 678 additions and 599 deletions

View File

@@ -13,7 +13,6 @@ fn main() {
};
let mut output = String::with_capacity(2048);
cmark(
Parser::new_ext(&md, pulldown_cmark::Options::all()).map(|e| {
use pulldown_cmark::Event::*;
@@ -21,7 +20,7 @@ fn main() {
Start(ref tag) => {
use pulldown_cmark::Tag::*;
match tag {
CodeBlock(code) => Start(CodeBlock(format!("ignore{}", code).into())),
CodeBlock(code) => Start(CodeBlock(format!("text{}", code).into())),
_ => e,
}
}