summary refs log tree commit diff
path: root/src/librustdoc/html/markdown.rs
AgeCommit message (Collapse)AuthorLines
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-3/+3
This commit removes superfluous to_string calls from various places
2014-06-19rustdoc: add the ability to run tests with --test.Huon Wilson-13/+20
This adds the `test_harness` directive that runs a code block using the test runner, to allow for `#[test]` items to be demonstrated and still tested (currently they are just stripped and not even compiled, let alone run).
2014-06-19rustdoc: refactor code block language info into a struct.Huon Wilson-42/+68
Fields have names, unlike an anonymous tuple.
2014-06-15Register new snapshotsAlex Crichton-2/+2
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-2/+6
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-10auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichtonbors-1/+1
2014-06-10Fix more misspelled comments and strings.Joseph Crail-1/+1
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-0/+1
2014-06-06rustdoc: Submit examples to play.rust-lang.orgAlex Crichton-6/+29
This grows a new option inside of rustdoc to add the ability to submit examples to an external website. If the `--markdown-playground-url` command line option or crate doc attribute `html_playground_url` is present, then examples will have a button on hover to submit the code to the playground specified. This commit enables submission of example code to play.rust-lang.org. The code submitted is that which is tested by rustdoc, not necessarily the exact code shown in the example. Closes #14654
2014-06-06auto merge of #14667 : aochagavia/rust/pr2, r=huonwbors-1/+1
2014-06-06Change to_str().to_string() to just to_str()Adolfo Ochagavía-1/+1
2014-06-05Fallout from the libcollections movementAlex Crichton-2/+2
2014-06-02docs: Stop using `notrust`Florian Gilcher-1/+2
Now that rustdoc understands proper language tags as the code not being Rust, we can tag everything properly. This change tags examples in other languages by their language. Plain notations are marked as `text`. Console examples are marked as `console`. Also fix markdown.rs to not highlight non-rust code.
2014-06-02rustdoc: make langstring parsing more robustFlorian Gilcher-4/+49
This changes the parsing of the language string in code examples so that unrecognized examples are not considered Rust code. This was, for example, the case when a code example was marked `sh` for shell code. This relieves authors of having to mark those samples as `notrust`. Also adds recognition of the positive marker `rust`. By default, unmarked examples are still considered rust. If any rust-specific tags are seen, code is considered rust unless marked as "notrust". Adds test cases for the detection logic.
2014-05-28std: Remove format_strbuf!()Alex Crichton-1/+1
This was only ever a transitionary macro.
2014-05-27std: Rename strbuf operations to stringRicho Healey-6/+6
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-1/+1
2014-05-25rustdoc: Prevent a segfault when using markdownAlex Crichton-0/+2
The field passed from markdown could sometimes be null, and it wasn't properly handled.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-2/+2
[breaking-change]
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-3/+4
[breaking-change]
2014-05-15Updates with core::fmt changesAlex Crichton-4/+3
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-13Touch up and rebase previous commitsAlex Crichton-0/+1
* Added `// no-pretty-expanded` to pretty-print a test, but not run it through the `expanded` variant. * Removed #[deriving] and other expanded attributes after they are expanded * Removed hacks around &str and &&str and friends (from both the parser and the pretty printer). * Un-ignored a bunch of tests
2014-05-12librustdoc: Remove all `~str` usage from librustdoc.Patrick Walton-10/+11
2014-05-07std: Modernize the local_data apiAlex Crichton-13/+10
This commit brings the local_data api up to modern rust standards with a few key improvements: * The `pop` and `set` methods have been combined into one method, `replace` * The `get_mut` method has been removed. All interior mutability should be done through `RefCell`. * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.replace()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-03rustdoc: Enable the footnote markdown extensionAlex Crichton-8/+10
This enables hoedown's footnote extension, and fixes all footnotes in the reference manual to use the new syntax.
2014-05-03rustdoc: Migrate from sundown to hoedownAlex Crichton-109/+119
This primary fix brought on by this upgrade is the proper matching of the ``` and ~~~ doc blocks. This also moves hoedown to a git submodule rather than a bundled repository. Additionally, hoedown is stricter about code blocks, so this ended up fixing a lot of invalid code blocks (ending with " ```" instead of "```", or ending with "~~~~" instead of "~~~"). Closes #12776
2014-04-26rustdoc: refactor and unstyle inline section headersAdrien Tétar-1/+1
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-1/+1
2014-04-10Remove some internal ~[] from several libraries.Huon Wilson-3/+3
Some straggling instances of `~[]` across a few different libs. Also, remove some public ones from workcache.
2014-04-06auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,mebors-1/+1
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-04Fix fallout from std::libc separationCorey Richardson-1/+1
2014-04-03rustdoc: Fix reporting of ignored testsIvan Petkov-6/+7
librustdoc: instead of skipping ignored tests, pass them to libtest so it can report them as such. If a test is marked as `notrust`, however, it will not show up in the final report.
2014-03-31Switch some tuple structs to pub fieldsAlex Crichton-2/+2
This commit deals with the fallout of the previous change by making tuples structs have public fields where necessary (now that the fields are private by default).
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-23iter: remove `to_owned_vec`Daniel Micay-3/+3
This needs to be removed as part of removing `~[T]`. Partial type hints are now allowed, and will remove the need to add a version of this method for `Vec<T>`. For now, this involves a few workarounds for partial type hints not completely working.
2014-03-20rename std::vec -> std::sliceDaniel Micay-7/+7
Closes #12702
2014-03-12rustdoc: whitelist the headers that get a § on hover.Huon Wilson-1/+1
Previously the :hover rules were making the links to the traits/types in something like impl<K: Hash + Eq, V> ... { ... } be displayed with a trailing `§` when hovered over. This commit restricts that behaviour to specific headers, i.e. those that are known to be section headers (like those rendered in markdown doc-comments, and the "Modules", "Functions" etc. headings).
2014-03-09rustdoc: hardcode each header as a link.Huon Wilson-1/+2
This avoids having to include JS in the guide/tutorial/manual pages just to get the headers being links. The on-hover behaviour showing the little section marker § is preserved, because that gives a useful hint that the heading is a link.
2014-03-09rustdoc: add table-of-contents recording & rendering, use it with plainHuon Wilson-10/+40
markdown files. This means that # Foo ## Bar # Baz ### Qux ## Quz Gets a TOC like 1 Foo 1.1 Bar 2 Baz 2.0.1 Qux 2.1 Quz This functionality is only used when rendering a single markdown file, never on an individual module, although it could very feasibly be extended to allow modules to opt-in to a table of contents (std::fmt comes to mind).
2014-03-09rustdoc: run on plain Markdown files.Huon Wilson-3/+15
This theoretically gives rustdoc the ability to render our guides, tutorial and manual (not in practice, since the files themselves need to be adjusted slightly to use Sundown-compatible functionality). Fixes #11392.
2014-03-08Add an option to not run rustdoc blocksSteven Fackler-5/+6
This is useful for code that would be expensive to run or has some kind of external dependency (e.g. a database or server).
2014-03-06rustdoc: Don't escape contents of headersAlex Crichton-2/+1
Turns out sundown has already escaped this content for us, so there's no need for us to escape it again. Closes #12736
2014-03-05rustdoc: Add anchors to section headersAlex Crichton-6/+69
This commit adds a appear-on-over link to all section headers to generated documentation. Each header also receives an id now, even those generated through markdown. The purpose of this is to provide easy to link to sections. This modifies the default header markdown generation because the default id added looks like "toc_NN" which is difficult to reconcile among all sections (by default each section gets a "toc_0" id), and it's also not very descriptive of where you're going. This chooses to adopt the github-style anchors by taking the contents of the title and hyphen-separating them (after lower casing). Closes #12681
2014-03-02rustdoc: syntax highlight macro definitions, colour $... substitutions.Huon Wilson-1/+1
Macro definitions are just their raw source code, and so should be highlighted where possible. Also, $ident non-terminal substitutions are special, and so are worth of a little special treatment.
2014-02-23auto merge of #12416 : alexcrichton/rust/highlight, r=huonwbors-2/+26
This adds simple syntax highlighting based off libsyntax's lexer to be sure to stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc, but it definitely seems to get the job done! This currently doesn't highlight rustdoc-rendered function signatures and structs that are emitted to each page because the colors already signify what's clickable and I think we'd have to figure out a different scheme before colorizing them. This does, however, colorize all code examples and source code. Closes #11393
2014-02-23std: Move intrinsics to std::intrinsics.Brian Anderson-1/+1
Issue #1457
2014-02-23rustdoc: Add syntax highlightingAlex Crichton-2/+26
This adds simple syntax highlighting based off libsyntax's lexer to be sure to stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc, but it definitely seems to get the job done! This currently doesn't highlight rustdoc-rendered function signatures and structs that are emitted to each page because the colors already signify what's clickable and I think we'd have to figure out a different scheme before colorizing them. This does, however, colorize all code examples and source code. Closes #11393
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-0/+2
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-02-14Update rustdoc testing to test all code blocksAlex Crichton-7/+9
It's too easy to forget the `rust` tag to have a code example tested, and it's far more common to have testable code than untestable code. This alters rustdoc to have only two directives, `ignore` and `should_fail`. The `ignore` directive ignores the code block entirely, and the `should_fail` directive has been fixed to only fail the test if the code execution fails, not also compilation.
2014-02-09std: Add init and uninit to mem. Replace direct intrinsic usageBrian Anderson-2/+3