This document specifies the syntax and Grammar of the SCDoc markup language. SCDoc Markup
is used in SuperCollider mainly for helpfiles. It is a syntax that features semantic a semantic level specific to the requirements of SuperCollider.
A document is split into a header section and a body. The header contains only header tags, which are not allowed in the document body.
SCDoc documents consist of tags and text.
::
(double-colon).TITLE::
, Title::
and title::
are interepreted equally.::
).Header tags take the remaining text in their definition line as their argument. They expect no end-tag.
TITLE::
nametitle:: SCDoc
CATEGORIES::
listCategories can be hierarchical, where levels are denoted with >
.
categories:: External Control>OSC, Scheduling>Clocks
RELATED::
link(s)related:: Classes/SCDoc, Reference/SCDocSyntax
SUMMARY::
textsummary:: SCDoc markup language syntax
REDIRECT::
nameredirect:: implClass
CLASS::
nameA document can be divided into sections and subsections. Section bodies consist of everything that follows its section tag until another section tag of same or higher level.
Sections have a link anchor with the same name as the section.
*
(class methods) or -
(instance methods).Structural tags at the same level in the hierarchy may be functionally equivalent but treated differently for rendering or querying purposes. For example examples::
is equivalent to 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.
Structural tags can have child elements, for example the items in a list or the subsections and prose in a section.
Level 1 (highest):
SECTION::
namesection:: Introduction
DESCRIPTION::
CLASSMETHODS::
INSTANCEMETHODS::
EXAMPLES::
Level 2:
SUBSECTION::
namesubsection:: Some more info
These are level 3 subsections:
METHOD::
methodname(s) [argstring]foo (a, b) bar (a, b, c) zoo (a)
But not:
foo (a, x) bar (a, b, c) zoo (y)
Following the method tag should come a short description of the method, and optional description of the arguments and return value. See the tags allowed inside a method section below.
SCDoc regards getter and setter methods as read/write interfaces for a single property. This means that you should not write the trailing underscore for setters. Instead, document it as a single property without the underscore, as if there was only a getter, and describe the property that can be set/gotten.
The METHOD tag is normally used inside CLASSMETHODS and INSTANCEMETHODS, but can also be used outside of these sections. In those cases, it documents a generic interface not bound to a specific class, and the arguments and default values should then be given in the optional argstring
For real methods, the argstring is not allowed, instead the argument names and default values will be auto-filled in.
PRIVATE::
methodname(s)COPYMETHOD::
classname methodname*
for classmethods and -
for instancemethods.copymethod:: SinOsc *ar
Inside a method section, the following optional tags are allowed, in the order given below. These tags are level 4 subsections.
ARGUMENT::
[argname]If the method has varargs, the argname for the varargs (if given) should be prefixed with three dots and a space ("... "
)
RETURNS::
DISCUSSION::
method:: ar, kr This is a nice method, try it out! argument:: freq The frequency of this thing as a floating point value. argument:: amp The amplitude, be careful. Goes to 11. returns:: An UGen.
These tags enclose a text and ends with a single ::
(double-colon) end-tag. The enclosed text can not contain any other tags.
STRONG::
EMPHASIS::
SOFT::
LINK::
Classes/SinOsc
or Reference/SCDocSyntax
Optionally, the path can be followed by #anchor
to jump to a specific place in the document, and #label
to specify another label for the link.
All kinds of sections automatically creates an anchor with the same name as the section. Methods also creates an anchor, with the methodname prefixed with *
for class methods and -
for instance methods.
The path can be empty for linking to an anchor inside the current document, and the anchor can be empty to only specify the link label.
See section link::#Introduction:: in this document. Take a look at link::Classes/SCDoc#*indexAllDocuments:: Try link::Search#scdoc#Searching for SCDoc::, or perhaps link::Classes/SinOsc##go make some music::
URL's are automagically turned into links, but can be explicitly created with this tag, if one wants to use another link label.
ANCHOR::
IMAGE::
image::foo.png::
Optionally an image caption can be given:
image::foo.png#Figure 1::
And, the image can be clickable and link to another page:
image::foo.png#click this image#Classes/SinOsc::
Just leave the caption empty if you want a link but no caption.
The following tags (CODE and TELETYPE) can be written in two forms, either inline or block. Inline form has the end-tag on the same line, and need any enclosed double-colons that should be part of the text to be escaped with backslash (\
). Block form has the tag and end-tag on lines by themselves, and can take multi-line text. In block form, only a single end-tag on its own line counts and any end-tags inside the text should not be escaped (except if it's on a single line).
code:: inline form :: code:: block form :: <- needs no escaping can span multiple lines ::
List items, table rows and definition terms are denoted with ##
(double-hash). Table cells and definition descriptions are denoted with ||
(double-bar). Lists and tables can be nested, and ends with the end-tag.
TABLE::
table:: ## a 1 || a 2 || a 3 ## b 1 || b 2 || b 3 ## c 1 || c 2 || c 3 ::
Renders:
a 1 | a 2 | a 3 |
b 1 | b 2 | b 3 |
c 1 | c 2 | c 3 |
DEFINITIONLIST::
##
followed by a description prefixed with ||
. Example:definitionlist:: ## foo ## bar || Common dummy-variable names. ## SuperCollider || A very nice computer software. ::
LIST::
##
NUMBEREDLIST::
##
TREE::
##
These can have other tags in them, and ends with the end-tag.
NOTE::
WARNING::
FOOTNOTE::
Hello I'm a geek footnote:: 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" ::
The result looks like this: Hello I'm a geek1
KEYWORD::
keyword(s)kw_
will be created at the position of this tag.CLASSTREE::
classnameThe following is an exact specification of the grammar:
start ::= document document ::= START_FULL dochead optsections | START_PARTIAL sections | START_METADATA dochead optsections dochead ::= { headline } headline headline ::= ( headtag words2 | "CATEGORIES::" commalist | "RELATED::" commalist ) eol headtag ::= "CLASS::" | "TITLE::" | "SUMMARY::" | "REDIRECT::" sectiontag ::= "CLASSMETHODS::" | "INSTANCEMETHODS::" | "DESCRIPTION::" | "EXAMPLES::" optsections ::= [ sections ] sections ::= sections section | section | subsubsections section ::= ( "SECTION::" words2 eol | sectiontag ) optsubsections optsubsections ::= [ subsections ] subsections ::= subsections subsection | subsection | subsubsections subsection ::= "SUBSECTION::" words2 eol optsubsubsections optsubsubsections ::= [ subsubsections ] subsubsections ::= subsubsections subsubsection | subsubsection | body subsubsection ::= "METHOD::" methnames optMETHODARGS eol methodbody | "COPYMETHOD::" words eol | "PRIVATE::" commalist eol optMETHODARGS ::= [ METHODARGS ] methnames ::= { METHODNAME COMMA } METHODNAME methodbody ::= optbody optargs optreturns optdiscussion optbody ::= [ body ] optargs ::= [ args ] args ::= { arg } arg arg ::= "ARGUMENT::" ( words eol optbody | eol body ) optreturns ::= [ "RETURNS::" body ] optdiscussion ::= [ "DISCUSSION::" body ] body ::= blockA | blockB blockA ::= [ blockB | blockA ] bodyelem blockB ::= [ blockA ] prose bodyelem ::= rangetag body "::" | listtag listbody "::" | "TABLE::" tablebody "::" | "DEFINITIONLIST::" deflistbody "::" | blocktag wordsnl "::" | "CLASSTREE::" words eol | "KEYWORD::" commalist eol | EMPTYLINES | "IMAGE::" words2 "::" prose ::= { proseelem } proseelem proseelem ::= anyword | URL | inlinetag words "::" | "FOOTNOTE::" body "::" | NEWLINE inlinetag ::= "LINK::" | "STRONG::" | "SOFT::" | "EMPHASIS::" | "CODE::" | "TELETYPE::" | "ANCHOR::" blocktag ::= CODEBLOCK | TELETYPEBLOCK listtag ::= "LIST::" | "TREE::" | "NUMBEREDLIST::" rangetag ::= "WARNING::" | "NOTE::" listbody ::= { "##" body } "##" body tablerow ::= "##" tablecells tablebody ::= { tablerow } tablerow tablecells ::= { optbody "||" } optbody defterms ::= { "##" body } "##" body deflistrow ::= defterms "||" optbody deflistbody ::= { deflistrow } deflistrow anywordurl ::= anyword | URL anyword ::= TEXT | COMMA words ::= { anyword } anyword words2 ::= { anywordurl } anywordurl eol ::= NEWLINE | EMPTYLINES anywordnl ::= anyword | eol wordsnl ::= { anywordnl } anywordnl nocommawords ::= nocommawords TEXT | nocommawords URL | TEXT | URL commalist ::= { nocommawords COMMA } nocommawords