wiki:UserGuide/WikiStyleGuide

Contributing to the Wiki

For consistent wiki formatting, please adhere to the following style guidelines.

General Guidelines

  • Page Naming
    • Use a short and descriptive name using Camel Case (e.g. MyPageName)
  • Headings
    • Start page titles at depth corresponding to the page depth:
      • /wiki/PageName uses = My Page Title
      • /wiki/SectionName/PageName uses == My Page Title
    • The number of = equals the depth (e.g. === is depth 3)
  • Links
    • DO NOT use full URLs (i.e. http://wiki.cosmos-lab.org/…) when linking to pages within the wiki. Use the WikiPageNames link syntax instead.
    • When linking to pages that are children of the current page, use relative paths [wiki:./page/to/link/to text to display] instead of the absolute wiki path.
  • Instructions containing shell commands
    • For commands that will be copy pasted, ensure no prompt is present.
    • For bash scripts, start the code block with {{{#!shell
    • For terminal sessions, start the code block with {{{#!shell-session
    • If the command is to be run on a console: make sure the prompt starts with user@console:path$
    • If the command is to be run on a compute machine: make sure the prompt starts with root@node-name:path$

Page Specific Formatting

Section Pages

Pages that are introductory to larger sections that contain many sub-pages (e.g. the Tutorials page) should use the following as a starting point:

[[Include(WikiToC)]]

= Section Title
Brief description of the section...

[[TOC(SectionPageName/*,inline,nonumbering,notitle,noheading,depth=2)]]

The TOC macro will auto-generate an alphabetical inline list of links to sub-pages of the section. If the sub-pages need to have a specific order, feel free to edit the TOC macro or create the list by hand, but try to keep the style as similar as possible.

Individual Pages

Individual wiki pages should use the following as a starting point:

[[Include(WikiToC)]]

== Page Title
Brief description of the page...
[[PageOutline(3-6,,inline,unnumbered)]]

=== Sub Section Title
Sub section content...

For pages nested deeper, please increase the number of equal signs in the headings to account for the page depth accordingly (though max heading depth is 6). Otherwise, the auto-generated table of contents on parent pages may not generate correctly.

Tutorial Pages

Please us the following document skeleton when writing a tutorial.

{{{
[[Include(WikiToC)]]

== Tutorial Title

=== Description
Description and goal of the tutorial described here...
[[PageOutline(3-6,,inline,unnumbered)]]

=== Prerequisites
List prerequisites here...

=== Resource Requirements
List of specific resources or requirements, including OMF image name if applicable.

=== Setup
Steps to setup the tutorial...

=== Execution

==== The first thing you do
First step of the tutorial...

==== The second thing you do
Second step of the tutorial...
}}}

Code Blocks and Syntax Highlighting

When including raw source code blocks, try to use the appropriate syntax highlighting for the language used. Trac uses pygments to do syntax highlighting in code blocks.

Example 1

{{{#!shell
echo "foo"
}}}

will be rendered as

echo "foo"

Example 2

{{{#!ruby
defTopology('rxnode') { |t|
  # Load the topology of imaged nodes
  # These nodes are from most recent omf load command
  baseTopo = Topology['system:topo:imaged']

  # Draw a random node from the pool of active ones
  aNode = baseTopo.getUniqueRandomNode

  # Add this random node to this 'senderTopo' topology
  t.addNode(aNode)
  puts "RX: #{t.getNodeByIndex(0).to_s}"
}
}}}

will be rendered as

defTopology('rxnode') { |t|
  # Load the topology of imaged nodes
  # These nodes are from most recent omf load command
  baseTopo = Topology['system:topo:imaged']

  # Draw a random node from the pool of active ones
  aNode = baseTopo.getUniqueRandomNode

  # Add this random node to this 'senderTopo' topology
  t.addNode(aNode)
  puts "RX: #{t.getNodeByIndex(0).to_s}"
}

Common formats

Language Shortname to Use in Code Block
C code c
C++ code cpp
Python code python
Java java
Java Script js
Ruby code ruby
Ruby session irb
JSON json
JSON with no braces json-object
XML xml
YAML yaml
Docker docker, dockerfile
shell script bash, sh, shell
shell session console, shell-session
powershell powershell

more formats

Using Markdown or RestructuredText

To use Markdown instead of Tracs' own language, simply enclose the Markdown text in a code block starting with #!Markdown like this:

{{{#!Markdown
# Some Title
Sample text.

## A Sub Section
More sample text.

### Yet another sub section
Even more sample text.
}}}

or if you want to use RestructuredText instead, start the code block with #!rst like this:

{{{#!rst
**********
Some Title
**********
Sample text.

A Sub Section
#############
More sample text.

Yet another sub section
***********************
Even more sample text.
}}}
Last modified 5 months ago Last modified on May 11, 2020, 7:02:47 PM
Note: See TracWiki for help on using the wiki.