Struct RenderOptions
struct RenderOptions { ... }
Options for formatter functions.
Fields
hardbreaks: boolSoft line breaks in the input translate into hard line breaks in the output.
# use ; let mut options = default; assert_eq!; options.render.hardbreaks = true; assert_eq!;github_pre_lang: boolGitHub-style
<pre lang="xyz">is used for fenced code blocks with info tags.# use ; let mut options = default; assert_eq!; options.render.github_pre_lang = true; assert_eq!;full_info_string: boolEnable full info strings for code blocks
# use ; let mut options = default; assert_eq!; options.render.full_info_string = true; let html = markdown_to_html; assert!;width: usizeThe wrap column when outputting CommonMark.
# use ; #unsafe_: boolAllow rendering of raw HTML and potentially dangerous links.
# use ; let mut options = default; let input = "<script>\nalert('xyz');\n</script>\n\n\ Possibly <marquee>annoying</marquee>.\n\n\ [Dangerous](javascript:alert(document.cookie)).\n\n\ [Safe](http://commonmark.org).\n"; assert_eq!; options.render.unsafe_ = true; assert_eq!;escape: boolEscape raw HTML instead of clobbering it.
# use ; let mut options = default; let input = "<i>italic text</i>"; assert_eq!; options.render.escape = true; assert_eq!;list_style: ListStyleTypeSet the type of bullet list marker to use. Options are:
ListStyleType::Dashto use-(default)ListStyleType::Plusto use+ListStyleType::Starto use*
# use ; let mut options = default; let input = "- one\n- two\n- three"; assert_eq!; // default is Dash options.render.list_style = Plus; assert_eq!; options.render.list_style = Star; assert_eq!;sourcepos: boolInclude source position attributes in HTML and XML output.
Sourcepos information is reliable for all core block items, and most extensions. The description lists extension still has issues; see https://github.com/kivikakk/comrak/blob/3bb6d4ce/src/tests/description_lists.rs#L60-L125.
Sourcepos information is not reliable for inlines, and is not included in HTML without also setting
experimental_inline_sourcepos. See https://github.com/kivikakk/comrak/pull/439 for a discussion.# use ; let mut options = default; options.render.sourcepos = true; let input = "## Hello world!"; let xml = markdown_to_commonmark_xml; assert!;experimental_inline_sourcepos: boolInclude inline sourcepos in HTML output, which is known to have issues. See https://github.com/kivikakk/comrak/pull/439 for a discussion.
# use ; let mut options = default; options.render.sourcepos = true; let input = "Hello *world*!"; assert_eq!; options.render.experimental_inline_sourcepos = true; assert_eq!;escaped_char_spans: boolWrap escaped characters in a
<span>to allow any post-processing to recognize them.# use ; let mut options = default; let input = "Notify user \\@example"; assert_eq!; options.render.escaped_char_spans = true; assert_eq!;ignore_setext: boolIgnore setext headings in input.
# use ; let mut options = default; let input = "setext heading\n---"; assert_eq!; options.render.ignore_setext = true; assert_eq!;ignore_empty_links: boolIgnore empty links in input.
# use ; let mut options = default; let input = "[]()"; assert_eq!; options.render.ignore_empty_links = true; assert_eq!;gfm_quirks: boolEnables GFM quirks in HTML output which break CommonMark compatibility.
# use ; let mut options = default; let input = "****abcd**** *_foo_*"; assert_eq!; options.render.gfm_quirks = true; assert_eq!;prefer_fenced: boolPrefer fenced code blocks when outputting CommonMark.
# use str; # use ; let arena = new; let mut options = default; let input = "```\nhello\n```\n"; let root = parse_document; let mut buf = Vecnew; format_commonmark; assert_eq!; buf.clear; options.render.prefer_fenced = true; format_commonmark; assert_eq!;figure_with_caption: boolRender the image as a figure element with the title as its caption.
# use ; let mut options = default; let input = ""; assert_eq!; options.render.figure_with_caption = true; assert_eq!;tasklist_classes: boolAdd classes to the output of the tasklist extension. This allows tasklists to be styled.
# use ; let mut options = default; options.extension.tasklist = true; let input = "- [ ] Foo"; assert_eq!; options.render.tasklist_classes = true; assert_eq!;ol_width: usizeRender ordered list with a minimum marker width. Having a width lower than 3 doesn't do anything.
# use ; let mut options = default; let input = "1. Something"; assert_eq!; options.render.ol_width = 5; assert_eq!;
Implementations
impl Clone for RenderOptions
fn clone(self: &Self) -> RenderOptions
impl Copy for RenderOptions
impl Debug for RenderOptions
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for RenderOptions
fn default() -> RenderOptions
impl Freeze for RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnsafeUnpin for RenderOptions
impl UnwindSafe for RenderOptions
impl<T> Any for RenderOptions
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for RenderOptions
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for RenderOptions
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for RenderOptions
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for RenderOptions
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for RenderOptions
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for RenderOptions
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for RenderOptions
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for RenderOptions
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>