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"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
markdown = "1.0.0-alpha.21"
|
md = {version = "1.0.0-alpha.21", package = "markdown"}
|
||||||
rocket = "0"
|
rocket = "0"
|
||||||
shuttle-rocket = "*"
|
shuttle-rocket = "*"
|
||||||
shuttle-runtime = "*"
|
shuttle-runtime = "*"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use md::{to_html_with_options, CompileOptions, Options};
|
||||||
use rocket::{response::content::RawHtml, Responder};
|
use rocket::{response::content::RawHtml, Responder};
|
||||||
|
|
||||||
#[derive(Responder)]
|
#[derive(Responder)]
|
||||||
|
@ -8,15 +9,15 @@ pub(super) struct Markdown(RawHtml<String>);
|
||||||
impl FromStr for Markdown {
|
impl FromStr for Markdown {
|
||||||
type Err = String;
|
type Err = String;
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
markdown::to_html_with_options(
|
to_html_with_options(
|
||||||
s,
|
s,
|
||||||
&markdown::Options {
|
&Options {
|
||||||
compile: markdown::CompileOptions {
|
compile: CompileOptions {
|
||||||
allow_dangerous_html: true,
|
allow_dangerous_html: true,
|
||||||
allow_dangerous_protocol: true,
|
allow_dangerous_protocol: true,
|
||||||
..markdown::CompileOptions::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..markdown::Options::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.map(RawHtml)
|
.map(RawHtml)
|
||||||
|
|
Loading…
Reference in a new issue