diff --git a/build.rs b/build.rs index a971d27..8d24e6c 100644 --- a/build.rs +++ b/build.rs @@ -68,15 +68,18 @@ async fn commonmark() { // > It is generate from the latest CommonMark website. extern crate micromark; -use micromark::{{micromark_with_options, Options}}; +use micromark::{{micromark_with_options, CompileOptions, Options}}; use pretty_assertions::assert_eq; #[rustfmt::skip] #[test] fn commonmark() -> Result<(), String> {{ let danger = Options {{ - allow_dangerous_html: true, - allow_dangerous_protocol: true, + compile: CompileOptions {{ + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..CompileOptions::default() + }}, ..Options::default() }}; diff --git a/examples/lib.rs b/examples/lib.rs index ed108d2..d14f399 100644 --- a/examples/lib.rs +++ b/examples/lib.rs @@ -1,5 +1,7 @@ extern crate micromark; -use micromark::{micromark, micromark_to_mdast, micromark_with_options, Constructs, Options}; +use micromark::{ + micromark, micromark_to_mdast, micromark_with_options, CompileOptions, Options, ParseOptions, +}; fn main() -> Result<(), String> { // Turn on debugging. @@ -15,8 +17,11 @@ fn main() -> Result<(), String> { micromark_with_options( "
indented code?\n"
- /// );
- ///
- /// // Pass `constructs` to choose what to enable and disable:
- /// assert_eq!(
- /// micromark_with_options(
- /// " indented code?",
- /// &Options {
- /// constructs: Constructs {
- /// code_indented: false,
- /// ..Constructs::default()
- /// },
- /// ..Options::default()
- /// }
- /// )?,
- /// "indented code?
" - /// ); - /// # Ok(()) - /// # } - /// ``` - pub constructs: Constructs, - - /// Default line ending to use, for line endings not in `value`. + /// Default line ending to use when compiling to HTML, for line endings not + /// in `value`. /// /// Generally, micromark copies line endings (`\r`, `\n`, `\r\n`) in the /// markdown document over to the compiled HTML. @@ -662,7 +635,7 @@ pub struct Options { /// ## Examples /// /// ``` - /// use micromark::{micromark, micromark_with_options, Options, LineEnding}; + /// use micromark::{micromark, micromark_with_options, CompileOptions, LineEnding, Options}; /// # fn main() -> Result<(), String> { /// /// // micromark uses `\n` by default: @@ -676,7 +649,10 @@ pub struct Options { /// micromark_with_options( /// "> a", /// &Options { - /// default_line_ending: LineEnding::CarriageReturnLineFeed, + /// compile: CompileOptions { + /// default_line_ending: LineEnding::CarriageReturnLineFeed, + /// ..CompileOptions::default() + /// }, /// ..Options::default() /// } /// )?, @@ -696,17 +672,14 @@ pub struct Options { /// ## Examples /// /// ``` - /// use micromark::{micromark, micromark_with_options, Options, Constructs}; + /// use micromark::{micromark, micromark_with_options, CompileOptions, Options, ParseOptions}; /// # fn main() -> Result<(), String> { /// /// // `"Footnotes"` is used by default: /// assert_eq!( /// micromark_with_options( /// "[^a]\n\n[^a]: b", - /// &Options { - /// constructs: Constructs::gfm(), - /// ..Options::default() - /// } + /// &Options::gfm() /// )?, /// "\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\nb ↩
\n