From 6c57fb19e76625e9cec5a4d98044694d013d752a Mon Sep 17 00:00:00 2001 From: holly sparkles Date: Thu, 04 Jan 2024 21:43:10 +0100 Subject: [PATCH] Fix readmes not rendering github formatted markdown Signed-off-by: Jordan Doyle --- src/git.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/git.rs b/src/git.rs index 27f4e05..22468b8 100644 --- a/src/git.rs +++ a/src/git.rs @@ -10,7 +10,7 @@ use anyhow::{anyhow, Context, Result}; use axum::response::IntoResponse; use bytes::{BufMut, Bytes, BytesMut}; -use comrak::{ComrakOptions, ComrakPlugins}; +use comrak::{ComrakPlugins, Options}; use git2::{ DiffFormat, DiffLineType, DiffOptions, DiffStatsFormat, Email, EmailCreateOptions, ObjectType, Oid, Signature, TreeWalkResult, @@ -433,7 +433,17 @@ let highlighter = ComrakSyntectAdapter { syntax_set }; plugins.render.codefence_syntax_highlighter = Some(&highlighter); - comrak::markdown_to_html_with_plugins(s, &ComrakOptions::default(), &plugins) + // enable gfm extensions + // https://github.github.com/gfm/ + let mut options = Options::default(); + options.extension.autolink = true; + options.extension.footnotes = true; + options.extension.strikethrough = true; + options.extension.table = true; + options.extension.tagfilter = true; + options.extension.tasklist = true; + + comrak::markdown_to_html_with_plugins(s, &options, &plugins) } #[derive(Copy, Clone, Debug, PartialEq, Eq)] -- rgit 0.1.3