Module rustdoc::html::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,
    custom_code_classes_in_docs: true,
};
let html = md.into_string();
// ... something using html
Run

Structs§

  • CodeBlocks 🔒
    Adds syntax highlighting and playground Run buttons to Rust code blocks.
  • ExtraInfo 🔒
  • Footnotes 🔒
    Moves all footnote definitions to the end and add back links to the references.
  • Make headings links with anchor IDs and build up TOC.
  • Indices 🔒
  • LangString 🔒
  • 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.
  • A tuple struct like Markdown that renders the markdown escaping HTML tags and includes no paragraph tags.
  • A tuple struct like Markdown that renders only the first paragraph.
  • A struct like Markdown that renders the markdown with a table of contents.
  • Extracts just the first paragraph.
  • Wrap HTML tables into <div> to prevent having the doc blocks width being too big.
  • This is the parser for fenced codeblocks attributes. It implements the following eBNF:

Enums§

Constants§

Statics§

Functions§

Type Aliases§