[−][src]Module rustdoc::html::markdown

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::{IdMap, Markdown, ErrorCodes};

let s = "My *markdown* _text_";
let mut id_map = IdMap::new();
let md = Markdown(s, &[], &mut id_map, ErrorCodes::Yes, Edition::Edition2015, &None);
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.

HeadingLinks

Make headings links with anchor IDs and build up TOC.

IdMap
LangString
LinkReplacer

Make headings links with anchor IDs and build up TOC.

Markdown

When to_string is called, this struct will emit the HTML corresponding to the rendered version of the contained markdown string.

MarkdownHtml

A tuple struct like Markdown that renders the markdown escaping HTML tags.

MarkdownSummaryLine

A tuple struct like Markdown that renders only the first paragraph.

MarkdownWithToc

A tuple struct like Markdown that renders the markdown with a table of contents.

Playground
RustCodeBlock
SummaryLine

Extracts just the first paragraph.

Enums

ErrorCodes
Ignore
Line

Controls whether a line will be hidden or shown in HTML output.

Functions

check_if_allowed_tag
find_testable_code
init_id_map
map_line
markdown_links
opts
plain_text_summary

Renders the first paragraph of the provided markdown as plain text.

rust_code_blocks

Returns a range of bytes for each code block in the markdown that is tagged as rust or untagged (and assumed to be rust).

slugify

Convert chars from a title for an id.