GREsau / schemars

Generate JSON Schema documents from Rust code
https://graham.cool/schemars/
MIT License
797 stars 223 forks source link

Fix the issues of strip and merge desc for code block #251

Open chenyukang opened 11 months ago

chenyukang commented 11 months ago

The strip and merge operations in get_doc and merge_description_lines will mess up code block format(or markdown format).

This PR tries to avoid it in some scenarios.

fhennig commented 9 months ago

Hey! Great, this is exactly what I'd need, I'd be happy if this gets merged! Currently workaround would be to use #[schemars(description=...)] as it doesn't do the same processing, but it'd be much nicer to continue writing the docs in the Rust doc strings.

chenyukang commented 9 months ago

#[schemars(description=...)] is not a proper way for long description content.

For our project, we have a lot of very long documents in markdown: https://github.com/nervosnetwork/ckb/blob/develop/rpc/src/module/subscription.rs#L86-L171

my current PR is fixing the current strip and merge to avoid mess up format, maybe we should also add an option to don't do this kind of thing, keep good style is the responsibility of users.