initial commit

This commit is contained in:
kitsunecafe 2024-01-29 05:37:08 -05:00
commit 1c40ea8e00
3 changed files with 31 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
/Cargo.lock

10
Cargo.toml Normal file
View 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
View 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)
}
}