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 ---------------------------------------------------------------------
122 hasText: tag captures text
123 S is single-line (terminated by newline)
125 hasChilds: tag captures child-elements
126 structural: tag has structural level
127 needClose: tag needs closing by ::
128 modal: tag ignores any other tags than closing tag and do not nest
129 nestable: tag can nest
134 ## modal tags can be written as inline (opening and closing tag on the same line)
135 or block-style (the closing tag must be a single \:: on its own line).
136 ## single vs variable line is only applicable for tags that captures text.
137 ## modal, level and nestable are exclusive. nestable can be seen as a structural tag
138 without explicit level. It's also because of the explicit level that the structural
139 tags don't need closing.
140 ## structural-needClose-modal-nestable could be reduced to one column:
142 ## 1-4 || level, no close tag
143 ## M || modal, need close tag
144 ## N || nestable, need close tag
148 subsection:: Document attributes
150 These should only occur once in a document, and might be compulsory.
159 subsection:: Structural tags
161 These are grouped by their level in the hierarchy, from high to low:
175 description, examples and methods are equivalent to code::section\:::: structurally, but used to identify these special sections and render them consistently.
177 subsection:: Methods and arguments
179 Methods should appear under code::instancemethods\:::: or code::classmethods\::::, and are written with code:: method\:: name(s) ::.
180 Do strong::not:: enter any arguments here, only the name.
181 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.
183 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\:: ::.
185 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.
187 There is an optional code::returns\:::: tag that could be used to describe the methods return value.
189 If a longer discussion is needed, use the code::discussion\:::: tag. This is a good place to insert example code, etc.
191 Method signatures and argument defaults are filled in automagically.
193 Also, when multiple methods have the same signature (like ar and kr in ugens), they should all be listed in one single method tag.
201 short description here...
216 returns:: some kind of value
219 Here is a longer detailed discussion about this method, perhaps with example code, etc..
222 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.
224 subsection:: Copy methods from other class
225 You can use code:: copymethod\:: ClassName, methodName :: to copy the documentation of a method from another helpfile to this one.
227 code::methodName:: must be prefixed with code::*:: (asterix) for class methods and code::-:: (dash) for instance methods.
230 The copied method must itself be a real code::method:: doc, not another code::copymethod::.
233 subsection:: Modal tags
244 All of above are closed with \::
245 If they are used as block tags, the closing \:: must be written as a single word on its own line.
246 Since they are modal tags, they can't be nested and any other tag than the closing tag is ignored until they are closed.
248 subsection:: Tables and lists
256 Tables and lists are kind of structural tags, but need to be closed with \::
257 They use code::##:: and code::||:: to delimit items/rows and table columns.
261 ## one || two || three
275 ## one || the first thing has three subthings:
281 ## two || the second thing
285 subsection:: ClassTree
287 A special tag to render a class hierarchy tree:
292 subsection:: Notes and warnings
298 These tags can be multi-line and must end with \:: . They can contain other tags.
302 URL's are automagically converted to links.
304 The code::link\:::: tag is used for cross-reference between docs. It uses a simple namespace, example:
306 See also link::Classes/SinOsc:: for a nice oscillator.
307 Or take a look at link::Browse#UGens:: for a full list.
308 The link::Overviews/Methods#play#play method:: is often very useful.
311 Anchors can be inserted manually with code::anchor\::name\:::: and referenced like this: code::
312 link::Foo/Bar#hello::
314 or to jump to an anchor in this document: code::
318 All sections get anchor names automagically, by making it lowercase and replacing spaces with '_' (underscore).
320 All methods get anchor names prefixed with code::*:: for class methods and code::-:: for instance methods.
322 One can change the rendered text of the link by using another code::#:: character:
324 Also see link::Classes/SinOsc##a nice oscillator::
327 A link to specific methods:
329 Take a look at link::Classes/SinOsc#*ar:: and link::Classes/Function#-play::
331 Renders as: link::Classes/SinOsc#*ar:: and link::Classes/Function#-play::
333 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:: :
335 All classes implementing code::play:: can be seen link::Overviews/Methods#play#here::.
337 Renders as: All classes implementing code::play:: can be seen link::Overviews/Methods#play#here::.
339 The link::Browse:: page is also dynamic, and can take a category tree as anchor name:
341 For more filters, see link::Browse#UGens>Filters::
343 Renders as: For more filters, see link::Browse#UGens>Filters::
347 Images can be inserted with: code::
351 A caption can be added like this: code::
352 image::filename#caption::
355 subsection:: Footnotes
356 Footnotes can be entered like this:
358 Hello I'm a geek footnote::
359 According to http://en.wikipedia.org/wiki/Geek the word geek is a slang term, with different
360 meanings ranging from "a computer expert or enthusiast" to "a carnival performer who performs
361 sensationally morbid or disgusting acts"
365 The result looks like this:
366 Hello I'm a geek footnote::
367 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"
370 subsection:: Document types
372 Document type is inferred by seeing if the document has a code::class\:::: or code::title\:::: tag.
374 Some tags are only allowed in some types of documents. Tags not mentioned below are allowed in all types:
376 ## Class (and UGen) reference docs || tags: class, description, methods, examples, subsection
377 ## Other docs (tutorials and such) || tags: title, section, subsection
380 Also, documents are organized in a simple directory layout after their "kind":
392 An example of documentation for LFPulse UGen:
396 summary::pulse oscillator
397 categories::UGens>Generators>Deterministic, UGens>Oscillators
398 related::Classes/LFSaw
401 A non-band-limited pulse oscillator. Outputs a high value of one and a low value of zero.
412 initial phase offset in cycles ( 0..1 )
415 pulse width duty cycle from zero to one.
421 { LFPulse.ar(Line.kr(100, 800, 0.1)) }.plot(0.1);
426 { LFPulse.ar(50) * 0.1 }.play;