Switch to pulldown-cmark for markdown parsing + Try to parse mentions

It's not working correctly yet for some reason…
This commit is contained in:
Bat
2018-06-20 15:29:19 +01:00
parent b9951f0d70
commit 4ea071e709
5 changed files with 66 additions and 143 deletions
+1 -14
View File
@@ -1,4 +1,3 @@
use comrak::{markdown_to_html, ComrakOptions};
use heck::KebabCase;
use rocket::request::Form;
use rocket::response::{Redirect, Flash};
@@ -88,19 +87,7 @@ fn create(blog_name: String, data: Form<NewPostForm>, user: User, conn: DbConn)
if slug == "new" || Post::find_by_slug(&*conn, slug.clone(), blog.id).is_some() {
Redirect::to(uri!(new: blog = blog_name))
} else {
let content = markdown_to_html(form.content.to_string().as_ref(), &ComrakOptions{
smart: true,
safe: true,
ext_strikethrough: true,
ext_tagfilter: true,
ext_table: true,
ext_autolink: true,
ext_tasklist: true,
ext_superscript: true,
ext_header_ids: Some("title".to_string()),
ext_footnotes: true,
..ComrakOptions::default()
});
let content = utils::md_to_html(form.content.to_string().as_ref());
let post = Post::insert(&*conn, NewPost {
blog_id: blog.id,