diff options
author | 2022-06-21 12:06:51 +0200 | |
---|---|---|
committer | 2022-06-21 12:06:51 +0200 | |
commit | f99d131ec3ab60956344d001bcd40244343c241b (patch) | |
tree | ac798f9a6a1ab73021cdd5a5303e20424d37172e /src/lib.rs | |
parent | 182467c1d393dee2081ff80f1c049cb145f23123 (diff) | |
download | markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.tar.gz markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.tar.bz2 markdown-rs-f99d131ec3ab60956344d001bcd40244343c241b.zip |
Add support for inferring line ending, configurable
* Rename `CompileOptions` to `Options`
* Add support for an optional default line ending style
* Add support for inferring the used line ending style
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -14,7 +14,7 @@ mod tokenizer; mod util; use crate::compiler::compile; -pub use crate::compiler::CompileOptions; +pub use crate::compiler::{LineEnding, Options}; use crate::parser::parse; /// Turn markdown into HTML. @@ -30,7 +30,7 @@ use crate::parser::parse; /// ``` #[must_use] pub fn micromark(value: &str) -> String { - micromark_with_options(value, &CompileOptions::default()) + micromark_with_options(value, &Options::default()) } /// Turn markdown into HTML, with configuration. @@ -38,17 +38,18 @@ pub fn micromark(value: &str) -> String { /// ## Examples /// /// ```rust -/// use micromark::{micromark_with_options, CompileOptions}; +/// use micromark::{micromark_with_options, Options}; /// -/// let result = micromark_with_options("<div>\n\n# Hello, world!\n\n</div>", &CompileOptions { +/// let result = micromark_with_options("<div>\n\n# Hello, world!\n\n</div>", &Options { /// allow_dangerous_html: true, /// allow_dangerous_protocol: true, +/// default_line_ending: None, /// }); /// /// assert_eq!(result, "<div>\n<h1>Hello, world!</h1>\n</div>"); /// ``` #[must_use] -pub fn micromark_with_options(value: &str, options: &CompileOptions) -> String { +pub fn micromark_with_options(value: &str, options: &Options) -> String { let (events, codes) = parse(value); compile(&events, &codes, options) } |