/** * ASCIIDoc Language Definition * */ (function($) { var ASCIIDoc = { 'function-bold' : { search: /(^[\n]+)([\n\s]*)/g, replace: "*$1*$2" }, 'function-italic' : { search: /(^[\n]+)([\n\s]*)/g, replace: "_$1_$2" }, 'function-code' : { search: /(^[\n]+)([\n\s]*)/g, replace: "+$1+$2" }, 'function-ul' : { search: /(^[\n]+)([\n\s]*)/g, replace: "* $1$2" }, 'function-ol' : { search: /(.+)([\n]?)/g, replace: ". $1$2" }, 'function-blockquote' : { search: /(.+)([\n]?)/g, replace: "----\n$1$2\n----\n" }, 'function-link' : { exec: function( txt, selText, $field ) { var results = null; $.GollumEditor.Dialog.init({ title: 'Insert Link', fields: [ { id: 'text', name: 'Link Text', type: 'text', help: 'The text to display to the user.' }, { id: 'href', name: 'URL', type: 'text', help: 'The URL to link to.' } ], OK: function( res ) { var h = ''; if ( res['text'] && res['href'] ) { h = res['href'] + '[' + res['text'] + ']'; } $.GollumEditor.replaceSelection( h ); } }); } }, 'function-image' : { exec: function( txt, selText, $field ) { var results = null; $.GollumEditor.Dialog.init({ title: 'Insert Image', fields: [ { id: 'url', name: 'Image URL', type: 'text' }, { id: 'alt', name: 'Alt Text', type: 'text' } ], OK: function( res ) { var h = ''; if ( res['url'] && res['alt'] ) { h = 'image::' + res['url'] + '[' + res['alt'] + ']'; } $.GollumEditor.replaceSelection( h ); } }); } } }; $.GollumEditor.defineLanguage('asciidoc', ASCIIDoc); var ASCIIDocHelp = [ { menuName: 'Text Formatting', content: [ { menuName: 'Headers', data: '
ASCIIDoc headers can be written in two ways: with differing underlines or with different indentation using =
(equals sign). ASCIIDoc supports headings 1-4. The editor will automatically use the =
notation. To create a level one header, prefix your line with one =
. Level two headers are created with ==
and so on.
To display text as bold, wrap the text in *
(asterisks). To display text as italic, wrap the text in _
(underscores). To create monospace
text, wrap the text in +
(plus signs).'
},
{
menuName: 'Scripts',
data: '
Superscript and subscript is created the same way as other inline formats. To create superscript text, wrap your text in ^
(carats). To create subscript text, wrap your text in ~
(tildes).
ASCIIDoc will automatically convert textual representations of commonly-used special characters. For example, (R)
becomes ®, (C)
becomes © and (TM)
becomes ™.
ASCIIDoc allows paragraphs to have optional titles or icons to denote special sections. To make a normal paragraph, simply add a line between blocks and a new paragraph will start. If you want to title your paragraphs, adda line prefixed by .
(full stop). An example paragraph with optional title is displayed below:.Optional Title
This is my paragraph. It is two sentences long.
To create source blocks (long blocks of code), follow the same syntax as above but with an extra line denoting the inline source and lines of four dashes (----
) delimiting the source block.. An example of Python source is below:.python.py
[source,python]
----
# i just wrote a comment in python
# and maybe one more
----
Comment blocks are useful if you want to keep notes for yourself inline but do not want them displayed to the public. To create a comment block, simply wrap the paragraph in dividers with four slashes (////
). An example comment block is below:////
My comment block is here now
It can be multiple paragraphs. Really.
////
Quote blocks work much like comment blocks — simply create dividers using four underscores (____
) around your quote. An example quote block is displayed below:____
This is my quote block. Quote something nice here, otherwise there is no point in quoting.
____
To create links to external pages, you can simply write the URI if you want the URI to link to itself. (i.e., http://github.com/
will automatically be parsed to http://github.com/. If you want different text to be displayed, simply append it to the end of the URI in between [
(brackets.) For example, http://github.com/[GitHub]
will be parsed as GitHub, with the URI pointing to http://github.com
.
Images in ASCIIDoc work much like hyperlinks, but image URLs are prefixed with image:
. For example, to link to an image at images/icons/home.png
, write image:images/icons/home.png
. Alt text can be added by appending the text to the URI in [
(brackets).