aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-05 00:24:36 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-05 00:24:36 -0800
commita7fb72e1a4a5f371326fe1efe8aeffb75bde243d (patch)
treee65373414df92bcd9c7263b01589e546abce0a37 /src/bin
parentaf3af9dd11f3573cf96c9b14b8566b345aad5e8e (diff)
downloadmodelthing-a7fb72e1a4a5f371326fe1efe8aeffb75bde243d.tar.gz
modelthing-a7fb72e1a4a5f371326fe1efe8aeffb75bde243d.zip
switch from 'markdown' to 'pulldown-cmark' for markdown rendering
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/mt-webface.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bin/mt-webface.rs b/src/bin/mt-webface.rs
index ccf4660..3d17bb5 100644
--- a/src/bin/mt-webface.rs
+++ b/src/bin/mt-webface.rs
@@ -3,7 +3,7 @@ extern crate getopts;
extern crate pencil;
extern crate modelthing;
extern crate env_logger;
-extern crate markdown;
+extern crate pulldown_cmark;
#[macro_use]
extern crate log;
@@ -55,13 +55,18 @@ fn model_view(r: &mut Request) -> PencilResult {
let model_path = Path::new(namespace).join(model_slug);
match modelthing::load_model_entry(model_path.as_path()) {
Ok(me) => {
+ let mut markdown_html = String::new();
+ let p = pulldown_cmark::Parser::new_ext(
+ &me.markdown,
+ pulldown_cmark::Options::empty());
+ pulldown_cmark::html::push_html(&mut markdown_html, p);
let mut context = BTreeMap::new();
context.insert("namespace".to_string(), namespace.to_string());
context.insert("model_slug".to_string(), model_slug.to_string());
context.insert("model_name".to_string(), me.ast.name.clone());
context.insert("model_description".to_string(), me.ast.description.clone().unwrap_or("".to_string()));
- context.insert("markdown_html".to_string(), markdown::to_html(&me.markdown));
- context.insert("markdown".to_string(), me.markdown);
+ context.insert("markdown_html".to_string(), markdown_html);
+ context.insert("markdown".to_string(), me.markdown.clone());
context.insert("modelica".to_string(), format!("{:?}", me.ast));
r.app.render_template("model_view.html", &context)
},