wooorm / markdown-rs

CommonMark compliant markdown parser in Rust with ASTs and extensions

Home Page:https://docs.rs/markdown/1.0.0-alpha.17/markdown/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should json be default feature ?

pinkforest opened this issue · comments

$ cargo update

    Updating crates.io index
      Adding itoa v1.0.5
    Updating markdown v1.0.0-alpha.5 -> v1.0.0-alpha.6
      Adding ryu v1.0.12
      Adding serde v1.0.152
      Adding serde_json v1.0.92

I am using mdast just to parse it and then process the mdast structures, e.g. I don't need json or any serialization out.

Would there be openness to having it as optional considering there are different ways to serialize out ?

Thanks for the great work btw ! 💜

Most of the ecosystem has serde as optional feature

commented

It is optional?

serde = { version = "1.0", features = ["derive"], optional = true }

Yes but it's on-by-default activated as it's coming via default = ["json"]

commented

Ah okay. So you can already turn it off, and then get what you are asking above, right?

But you think it should default to not having serde? Why do you want that?

People are used in the Rust ecosystem way to turn serde on or any other supplementary functionality.

Default feature set should not generally have any supplemental functionality enabled -

serde increases code sizes where I would expect a parser crate only to enable what is required for parsing

Ecosystem normal way is to not have default features that are not needed for the crate's primary function which in this case is parsing and not re-serializing which is optional additive feature especially since people can either choose html or json serialization optionally.

By turning it off we have to specify default-features = false and list all the features explicitly leading to pain to track all the changing features across the relases increasing maintenance overhead.

Code sizes are important for core parsing libraries especially in wasm/embedded contexts.