camoifier in markdown

This commit is contained in:
Luna D 2021-09-13 21:55:42 +02:00
parent 6aa9baefd2
commit 670242bc13
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8
3 changed files with 7 additions and 14 deletions

View file

@ -149,7 +149,7 @@ dependencies = [
[[package]] [[package]]
name = "comrak" name = "comrak"
version = "0.12.1" version = "0.12.1"
source = "git+https://github.com/philomena-dev/comrak?branch=main#94941ad6f41fa308383601e5b098c643e3bf80e2" source = "git+https://github.com/philomena-dev/comrak?branch=main#a4da46ece62bc99a82cfffb37fa7798d1b1da132"
dependencies = [ dependencies = [
"clap", "clap",
"entities", "entities",
@ -197,9 +197,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.21" version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80edafed416a46fb378521624fab1cfa2eb514784fd8921adbe8a8d8321da811" checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"crc32fast", "crc32fast",

View file

@ -1,11 +0,0 @@
let
pkgs = import <nixos> {};
in pkgs.mkShell {
buildInputs = [
pkgs.cargo
pkgs.rustc
pkgs.rustfmt
pkgs.clippy
pkgs.rust-analyzer
];
}

View file

@ -1,4 +1,5 @@
use comrak::ComrakOptions; use comrak::ComrakOptions;
use crate::camo;
fn common_options() -> ComrakOptions { fn common_options() -> ComrakOptions {
let mut options = ComrakOptions::default(); let mut options = ComrakOptions::default();
@ -11,6 +12,9 @@ fn common_options() -> ComrakOptions {
options.parse.smart = true; options.parse.smart = true;
options.render.hardbreaks = true; options.render.hardbreaks = true;
options.render.github_pre_lang = true; options.render.github_pre_lang = true;
options.extension.camoifier = Some(|s| camo::image_url(s).unwrap_or_else(|| String::from("")));
options options
} }