2 summary:: SCDoc markup language syntax
3 categories:: HelpSystem
4 related:: Guides/WritingHelp, Classes/SCDoc, Classes/SCDocParser, Classes/SCDocRenderer
6 This ML consists of a specification for writing documents with semantic annotations, in a manner which does not target a specific layout or output format. Its purpose is to allow for human-writable documents to be produced in a variety of formats and for a variety of target platforms. Usability and learnability are paramount, so the syntax is as simple as possible.
8 A guide to writing help can be found here: link::Guides/WritingHelp::.
10 section::Markup Language Syntax
12 Documents consist of tags and text. Some tags associate text with them, some just denotes a structural location in the document. Untagged text is treated as 'normal prose'.
14 Tags are of two types, single-line tags and range tags, indicated using code::keyword\::::
16 Tags are case insensitive, code::FooBar\:::: is the same as code::foobar\:::: or code::FOOBAR\::::
18 Some tags might only be meaningful after other tags, like code::argument\:::: after code::method\::::
20 Single-line tags are specified like so, and terminated with a newline. They can have a text associated with the tag:
22 foo:: some text associated with this tag
24 This is "normal prose" and the above tag just denotes a section or location in the document.
27 Single-line tags that don't associate with text will treat any text starting on the same line after the tag as normal prose:
29 bar:: This is also "normal prose" as above, since this particular tag doesn't take any text.
32 Any untagged text following the newline will be treated as normal prose. For example:
34 title:: This text will be treated as a 'title'.
35 This is 'normal prose' since it's untagged.
36 section:: This text is a section title
37 This is also normal prose.
40 Some single-line tags, e.g. code::related\:::: and code::summary\:::: can be understood as floating, i.e. the renderer will decide how and where to place them. Some tags are not even actually rendered to the output but only provides document metadata, e.g. code::categories\::::.
42 Range tags consist of an opening tag and a closing tag. They can be written as a block:
49 They can also occur on the same line inside normal prose:
51 This is some normal prose containing a code::inline code example::.
52 Also see link::Foo:: for more information.
54 Some tags are "modal" tags and can't be nested, they would ignore any other tags inside it.
55 If they are used as block tags, the closing \:: must be written as a single word on its own line.
57 subsection:: Structure
59 Some tags have structural meaning (for instance identifying a document section). They may or may not have text directly associated with them, for example a code:: section\:: section_title ::. Structural tags are hierarchical in nature, and persist until the next tag of the same or higher level.
62 Here's some normal prose.
63 subsection:: Subsection 1
65 subsection:: Subsection 2
68 The examples tag is at the same level in the hierarchy as section,
69 so Section 1 ends at the examples tag above.
72 Structural tags at the same level in the hierarchy may be functionally equivalent, but treated differently for rendering or querying purposes. For example code::examples\:::: is equivalent to code::section\:::: but imply particular formatting or specially identify the examples section for customised uses like concatenating all examples for classes with a given parent class.
74 Some structural tags don't have a specific section level, but builds hierarchies by using a close tag, like lists and tables. They can be nested.
76 All structural tags has children elements, for example the items in a list or the subsections and prose in a section.
78 section::Tags for use in the new SC Doc system
81 tag hasText hasChilds structural needClose modal nestable
82 ---------------------------------------------------------------------
123 hasText: tag captures text
124 S is single-line (terminated by newline)
126 hasChilds: tag captures child-elements
127 structural: tag has structural level
128 needClose: tag needs closing by ::
129 modal: tag ignores any other tags than closing tag and do not nest
130 nestable: tag can nest
135 ## modal tags can be written as inline (opening and closing tag on the same line)
136 or block-style (the closing tag must be a single \:: on its own line).
137 ## single vs variable line is only applicable for tags that captures text.
138 ## modal, level and nestable are exclusive. nestable can be seen as a structural tag
139 without explicit level. It's also because of the explicit level that the structural
140 tags don't need closing.
141 ## structural-needClose-modal-nestable could be reduced to one column:
143 ## 1-4 || level, no close tag
144 ## M || modal, need close tag
145 ## N || nestable, need close tag
149 subsection:: Document attributes
151 These should only occur once in a document, and might be compulsory.
160 subsection:: Structural tags
162 These are grouped by their level in the hierarchy, from high to low:
176 description, examples and methods are equivalent to code::section\:::: structurally, but used to identify these special sections and render them consistently.
178 subsection:: Methods and arguments
180 Methods should appear under code::instancemethods\:::: or code::classmethods\::::, and are written with code:: method\:: name(s) ::.
181 Do strong::not:: enter any arguments here, only the name.
182 After the method, there should be a short description. Even if it can be multiple lines, keep it short and use code::discussion\:::: if you need more.
184 Methods get an anchor name automatically, prefixed with code::*:: for class methods and code::-:: for instance methods. For example, to link to the code::foo:: class method, use code:: link\::#*foo\:: ::.
186 After the method description comes the arguments, written with code:: argument\:: name :: where code::name:: must correspond to one of the methods arguments. After each argument line comes the description of that argument.
188 There is an optional code::returns\:::: tag that could be used to describe the methods return value.
190 If a longer discussion is needed, use the code::discussion\:::: tag. This is a good place to insert example code, etc.
192 Method signatures and argument defaults are filled in automagically.
194 Also, when multiple methods have the same signature (like ar and kr in ugens), they should all be listed in one single method tag.
202 short description here...
217 returns:: some kind of value
220 Here is a longer detailed discussion about this method, perhaps with example code, etc..
223 Any undocumented methods will show up in the rendered help file. To ignore methods, put them in a code::private\:::: tag, which must come directly after the code::instancemethods:: or code::classmethods:: tag.
225 subsection:: Copy methods from other class
226 You can use code:: copymethod\:: ClassName, methodName :: to copy the documentation of a method from another helpfile to this one.
228 code::methodName:: must be prefixed with code::*:: (asterix) for class methods and code::-:: (dash) for instance methods.
231 The copied method must itself be a real code::method:: doc, not another code::copymethod::.
234 subsection:: Modal tags
245 All of above are closed with \::
246 If they are used as block tags, the closing \:: must be written as a single word on its own line.
247 Since they are modal tags, they can't be nested and any other tag than the closing tag is ignored until they are closed.
249 subsection:: Tables and lists
257 Tables and lists are kind of structural tags, but need to be closed with \::
258 They use code::##:: and code::||:: to delimit items/rows and table columns.
262 ## one || two || three
276 ## one || the first thing has three subthings:
282 ## two || the second thing
286 subsection:: ClassTree
288 A special tag to render a class hierarchy tree:
293 subsection:: Notes and warnings
299 These tags can be multi-line and must end with \:: . They can contain other tags.
303 URL's are automagically converted to links.
305 The code::link\:::: tag is used for cross-reference between docs. It uses a simple namespace, example:
307 See also link::Classes/SinOsc:: for a nice oscillator.
308 Or take a look at link::Browse#UGens:: for a full list.
309 The link::Overviews/Methods#play#play method:: is often very useful.
312 Anchors can be inserted manually with code::anchor\::name\:::: and referenced like this: code::
313 link::Foo/Bar#hello::
315 or to jump to an anchor in this document: code::
319 All sections get anchor names automagically, by making it lowercase and replacing spaces with '_' (underscore).
321 All methods get anchor names prefixed with code::*:: for class methods and code::-:: for instance methods.
323 One can change the rendered text of the link by using another code::#:: character:
325 Also see link::Classes/SinOsc##a nice oscillator::
328 A link to specific methods:
330 Take a look at link::Classes/SinOsc#*ar:: and link::Classes/Function#-play::
332 Renders as: link::Classes/SinOsc#*ar:: and link::Classes/Function#-play::
334 The link::Overviews/Methods:: overview is dynamic and allows a specific method to be shown, by using the methodname as anchor, for example to get a list of all classes implementing code::play:: :
336 All classes implementing code::play:: can be seen link::Overviews/Methods#play#here::.
338 Renders as: All classes implementing code::play:: can be seen link::Overviews/Methods#play#here::.
340 The link::Browse:: page is also dynamic, and can take a category tree as anchor name:
342 For more filters, see link::Browse#UGens>Filters::
344 Renders as: For more filters, see link::Browse#UGens>Filters::
348 Images can be inserted with: code::
352 A caption can be added like this: code::
353 image::filename#caption::
356 subsection:: Footnotes
357 Footnotes can be entered like this:
359 Hello I'm a geek footnote::
360 According to http://en.wikipedia.org/wiki/Geek the word geek is a slang term, with different
361 meanings ranging from "a computer expert or enthusiast" to "a carnival performer who performs
362 sensationally morbid or disgusting acts"
366 The result looks like this:
367 Hello I'm a geek footnote::
368 According to http://en.wikipedia.org/wiki/Geek the word geek is a slang term, with different meanings ranging from "a computer expert or enthusiast" to "a carnival performer who performs sensationally morbid or disgusting acts"
371 subsection:: Mathematics
372 Mathematics can be entered in TeX syntax using the code::math\:::: tag. Example:
374 This is inline math::2\pi:: and below is block display math:
382 This is inline math::2\pi:: and below is block display math:
387 subsection:: Document types
389 Document type is inferred by seeing if the document has a code::class\:::: or code::title\:::: tag.
391 Some tags are only allowed in some types of documents. Tags not mentioned below are allowed in all types:
393 ## Class (and UGen) reference docs || tags: class, description, methods, examples, subsection
394 ## Other docs (tutorials and such) || tags: title, section, subsection
397 Also, documents are organized in a simple directory layout after their "kind":
409 An example of documentation for LFPulse UGen:
413 summary::pulse oscillator
414 categories::UGens>Generators>Deterministic, UGens>Oscillators
415 related::Classes/LFSaw
418 A non-band-limited pulse oscillator. Outputs a high value of one and a low value of zero.
429 initial phase offset in cycles ( 0..1 )
432 pulse width duty cycle from zero to one.
438 { LFPulse.ar(Line.kr(100, 800, 0.1)) }.plot(0.1);
443 { LFPulse.ar(50) * 0.1 }.play;