wooorm / markdown-rs

CommonMark compliant markdown parser in Rust with ASTs and extensions
https://docs.rs/markdown/1.0.0-alpha.21/markdown/
MIT License
906 stars 50 forks source link

Field-variants rather than tuple-variants for Block, Span #90

Closed urbanite-municipalist closed 10 months ago

urbanite-municipalist commented 10 months ago

For the two enums

pub enum Block {
    Header(Vec<Span>, usize),
    Paragraph(Vec<Span>),
    Blockquote(Vec<Block>),
    CodeBlock(Option<String>, String),
    OrderedList(Vec<ListItem>, OrderedListType),
    UnorderedList(Vec<ListItem>),
    Raw(String),
    Hr,
}
pub enum Span {
    Break,
    Text(String),
    Code(String),
    Link(String, String, Option<String>),
    Image(String, String, Option<String>),
    Emphasis(Vec<Span>),
    Strong(Vec<Span>),
}

There are several variants, which are unnecessarily unclear. Could Block::CodeBlock, Span::Link, Span::Image, be replaced by field variants? Or could the separate components be documented?

https://docs.rs/markdown/0.3.0/src/markdown/parser/mod.rs.html#31-40 https://docs.rs/markdown/0.3.0/src/markdown/parser/mod.rs.html#10-20

Just writing what #[allow(missing_docs)] is allowing to be missing in these two cases.

Thank you.

wooorm commented 10 months ago

You use an unmaintained version of this crate. The crate changed owners. Use this project, not the old one.