rust-lang/rust — pull request #16991 by Gankro (2014-09-04 18:41:29+00:00)
Title: Add Mathjax Support to Rustdoc

I'm not *super* clear on the best way to use TLDs and `#![doc]` configs, but this seems to work, and isn't *obviously* wrong:

http://cg.scs.carleton.ca/~abeinges/doc/collections/vec/struct.Vec.html

However, the current design interacts weirdly with re-exports:

http://cg.scs.carleton.ca/~abeinges/doc/std/vec/struct.Vec.html

Detailed design:

Mathjax support will only be enabled on crates that declare `#!doc[(enable_mathjax)]`. When enabled mathjax can be used by wrapping math in double-dollars like so: `$$ \sqrt{x} + \log^2n $$`. If the dollars are part of a larger block element, the content will be rendered inline. If they surround an *entire* block, the math will be rendered in "display mode" as seen in my example pages. Note: the opening `$$`'s must have be lead by whitespace, and the closing `$$`'s must be followed by whitespace. Therefore `blah blah $$x^2$$.` will not render as math, because there is no whitespace between the last `$` and the `.`.