about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-11T11·25+0200
committerVincent Ambo <tazjin@gmail.com>2018-04-11T11·25+0200
commit87237f5c28f177830808aeb4710f72d31f14c045 (patch)
tree0e1c0468daeaabd472f347304c19f0617a4591f2 /src/main.rs
parent405e6340f86b5806e865c570e3afc28a1416cf34 (diff)
feat(render): Implement Markdown thread rendering & Gravatar
Implements a new thread rendering pipeline which all posts and the
main thread body are first converted to a `RenderablePost` structure.

During the conversion to this structure, the post body is rendered as
Markdown and the author's email address is converted into the format
required by Gravatar.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index a3ad3643044d..eeab96e83ced 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -87,8 +87,18 @@ fn main() {
 
     info!("Compiling templates ...");
     let template_path = concat!(env!("CARGO_MANIFEST_DIR"), "/templates/**/*");
-    let tera = compile_templates!(template_path);
-    let renderer = render::Renderer(tera);
+    let mut tera = compile_templates!(template_path);
+    tera.autoescape_on(vec![]);
+    let comrak = comrak::ComrakOptions{
+        github_pre_lang: true,
+        ext_strikethrough: true,
+        ext_table: true,
+        ext_autolink: true,
+        ext_tasklist: true,
+        ext_footnotes: true,
+        ..Default::default()
+    };
+    let renderer = render::Renderer{ tera, comrak };
     let renderer_addr: Addr<Syn, render::Renderer> = renderer.start();
 
     info!("Initialising HTTP server ...");