rename markdown to md
This commit is contained in:
parent
703ab6a2eb
commit
480c172707
2 changed files with 7 additions and 6 deletions
|
@ -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 = "*"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue