rename markdown to md

This commit is contained in:
Ponj 2024-11-15 14:20:11 -05:00
parent 703ab6a2eb
commit 480c172707
Signed by: p6nj
GPG key ID: 6FED68D87C479A59
2 changed files with 7 additions and 6 deletions

View file

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
markdown = "1.0.0-alpha.21"
md = {version = "1.0.0-alpha.21", package = "markdown"}
rocket = "0"
shuttle-rocket = "*"
shuttle-runtime = "*"

View file

@ -1,5 +1,6 @@
use std::str::FromStr;
use md::{to_html_with_options, CompileOptions, Options};
use rocket::{response::content::RawHtml, Responder};
#[derive(Responder)]
@ -8,15 +9,15 @@ pub(super) struct Markdown(RawHtml<String>);
impl FromStr for Markdown {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
markdown::to_html_with_options(
to_html_with_options(
s,
&markdown::Options {
compile: markdown::CompileOptions {
&Options {
compile: CompileOptions {
allow_dangerous_html: true,
allow_dangerous_protocol: true,
..markdown::CompileOptions::default()
..Default::default()
},
..markdown::Options::default()
..Default::default()
},
)
.map(RawHtml)