rustdoc::html

Module markdown

Source
Expand description

Markdown formatting for rustdoc.

This module implements markdown formatting through the pulldown-cmark library.

#![feature(rustc_private)]

extern crate rustc_span;

use rustc_span::edition::Edition;
use rustdoc::html::markdown::{HeadingOffset, IdMap, Markdown, ErrorCodes};

let s = "My *markdown* _text_";
let mut id_map = IdMap::new();
let md = Markdown {
    content: s,
    links: &[],
    ids: &mut id_map,
    error_codes: ErrorCodes::Yes,
    edition: Edition::Edition2015,
    playground: &None,
    heading_offset: HeadingOffset::H2,
};
let html = md.into_string();
// ... something using html

Modulesยง

  • footnotes ๐Ÿ”’
    Markdown footnote handling.

Structsยง

  • CodeBlocks ๐Ÿ”’
    Adds syntax highlighting and playground Run buttons to Rust code blocks.
  • ExtraInfo ๐Ÿ”’
  • HeadingLinks ๐Ÿ”’
    Make headings links with anchor IDs and build up TOC.
  • Indices ๐Ÿ”’
  • LangString ๐Ÿ”’
  • LinkReplacer ๐Ÿ”’
  • LinkReplacerInner ๐Ÿ”’
    Make headings links with anchor IDs and build up TOC.
  • When to_string is called, this struct will emit the HTML corresponding to the rendered version of the contained markdown string.
  • MarkdownItemInfo ๐Ÿ”’
    A tuple struct like Markdown that renders the markdown escaping HTML tags and includes no paragraph tags.
  • MarkdownLink ๐Ÿ”’
  • A tuple struct like Markdown that renders only the first paragraph.
  • MarkdownWithToc ๐Ÿ”’
    A struct like Markdown that renders the markdown with a table of contents.
  • MdRelLine ๐Ÿ”’
    A newtype that represents a relative line number in Markdown.
  • RustCodeBlock ๐Ÿ”’
  • SummaryLine ๐Ÿ”’
    Extracts just the first paragraph.
  • TableWrapper ๐Ÿ”’
    Wrap HTML tables into <div> to prevent having the doc blocks width being too big.
  • TagIterator ๐Ÿ”’
    This is the parser for fenced codeblocks attributes. It implements the following eBNF:

Enumsยง

Constantsยง

Functionsยง

Type Aliasesยง