🏡 index : ~doyle/rgit.git

author holly sparkles <sparkles@holly.sh> 2024-01-04 21:43:10.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-01-06 1:10:42.0 +00:00:00
commit
6c57fb19e76625e9cec5a4d98044694d013d752a [patch]
tree
f4e8097e3cfcccca7bb26c33d08f8bae2717f289
parent
35c138290d3958f844c87f47750378570fb9e3ca
download
6c57fb19e76625e9cec5a4d98044694d013d752a.tar.gz

Fix readmes not rendering github formatted markdown

Signed-off-by: Jordan Doyle <jordan@doyle.la>

Diff

 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)]