initial commit
This commit is contained in:
commit
1c40ea8e00
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
/Cargo.lock
|
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "roxy_markdown_parser"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
roxy_core = { git = "https://github.com/kitsunecafe/roxy-core.git" }
|
||||||
|
pulldown-cmark = "0.9.3"
|
19
src/lib.rs
Normal file
19
src/lib.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
use roxy_core::roxy::Parse;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct MarkdownParser;
|
||||||
|
|
||||||
|
impl MarkdownParser {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for MarkdownParser {
|
||||||
|
fn parse(&mut self, _path: &str, src: &[u8], dst: &mut Vec<u8>) -> std::io::Result<()> {
|
||||||
|
let src = String::from_utf8_lossy(src).to_string();
|
||||||
|
let parser = pulldown_cmark::Parser::new(src.as_str());
|
||||||
|
pulldown_cmark::html::write_html(dst, parser)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue