OLD | NEW |
---|---|
1 TODO(rnystrom): This is moving from a sample to being a real project. Right | 1 Dartdoc generates static HTML documentation from Dart code. |
2 now, to try this out: | |
3 | 2 |
4 1. Compile interact.dart to JS: | 3 To use it, from this directory, run: |
nweiz
2011/11/28 22:50:45
What would it take for this to be runnable from an
Bob Nystrom
2011/11/29 02:44:08
Some shell shenanigans. It's a little tricky even
| |
5 dartdoc$ ../../frog/frogsh --libdir=../../frog/lib --out=docs/interact.js \ | |
6 --compile-only interact.dart | |
7 | 4 |
8 2. Run the doc generator: | 5 $ dartdoc <path to .dart file> |
9 dartdoc$ ../../frog/frogsh --libdir=../../frog/lib dartdoc.dart dartdoc.dart | |
10 | 6 |
11 Note here that the first "dartdoc.dart" is to run this program, and the | 7 This will create a "docs" directory with the docs for your libraries. To do so, |
12 second is passing its own name to itself to generate its own docs. | 8 dartdoc parses that library and every library it imports. From each library, it |
9 parses all classes and members, finds the associated doc comments and builds | |
10 crosslinked docs from them. | |
13 | 11 |
14 3. Look at the results in frog/docs/ | 12 "Doc comments" can be in one of a few forms: |
13 | |
14 /** | |
15 * JavaDoc style block comments. | |
16 */ | |
17 | |
18 /** Which can also be single line. */ | |
19 | |
20 /// Triple-slash line comments. | |
21 /// Which can be multiple lines. | |
22 | |
23 The body of a doc comment will be parsed as markdown which means you can apply | |
24 most of the formatting and structuring you want while still having docs that | |
25 look nice in plain text. For example: | |
26 | |
27 /// This is a doc comment. This is the first paragraph in the comment. It | |
28 /// can span multiple lines. | |
29 /// | |
30 /// A blank line starts a new paragraph like this one. | |
31 /// | |
32 /// * Unordered lists start with `*` or `-` or `+`. | |
33 /// * And can have multiple items. | |
34 /// 1. You can nest lists. | |
35 /// 2. Like this numbered one. | |
36 /// | |
37 /// --- | |
38 /// | |
39 /// Three dashes, underscores, or tildes on a line by themselves create a | |
40 /// horizontal rule. | |
41 /// | |
42 /// to.get(a.block + of.code) { | |
43 /// indent(it, 4.lines); | |
44 /// like(this); | |
45 /// } | |
46 /// | |
47 /// There are a few inline styles you can apply: *emphasis*, **strong**, | |
48 /// and `inline code`. You can also use underscores for _emphasis_ and | |
49 /// __strong__. | |
50 /// | |
51 /// An H1 header using equals on the next line | |
52 /// ========================================== | |
53 /// | |
54 /// And an H2 in that style using hyphens | |
55 /// ------------------------------------- | |
56 /// | |
57 /// # Or an H1 - H6 using leading hashes | |
58 /// ## H2 | |
59 /// ### H3 | |
60 /// #### H4 you can also have hashes at then end: ### | |
61 /// ##### H5 | |
62 /// ###### H6 | |
63 | |
64 There is also an extension to markdown specific to dartdoc: A name inside | |
65 square brackets that is not a markdown link (i.e. doesn't have square brackets | |
66 or parentheses following it) like: | |
67 | |
68 Calls [someMethod], passing in [arg]. | |
69 | |
70 is understood to be the name of some member or type that's in the scope of the | |
71 member where that comment appears. Dartdoc will automatically figure out what | |
72 the name refers to and generate an approriate link to that member or type. | |
OLD | NEW |