diff --git a/src/html.rs b/src/html.rs index 4a33251f..fc8fb182 100644 --- a/src/html.rs +++ b/src/html.rs @@ -804,6 +804,9 @@ impl<'o> HtmlFormatter<'o> { if entering { self.output.write_all(b"")); /// ``` pub sourcepos: bool, + + /// Make all links in the document open in a new tab by setting `target="_blank"`. + /// + /// ```rust + /// # use comrak::{markdown_to_html, Options}; + /// let mut options = Options::default(); + /// options.render.target_blank = true; + /// let input = "Hello [world](https://www.github.com)!"; + /// let html = markdown_to_html(input, &options); + /// assert!(html.contains("target=\"_blank\"")); + /// + pub target_blank: bool, } #[non_exhaustive] diff --git a/src/tests/propfuzz.rs b/src/tests/propfuzz.rs index 645cb5ea..10caf226 100644 --- a/src/tests/propfuzz.rs +++ b/src/tests/propfuzz.rs @@ -36,6 +36,7 @@ fn propfuzz_doesnt_crash(md: String) { escape: false, list_style: ListStyleType::Dash, sourcepos: true, + target_blank: false, }, };