Newer
Older
labs / tiddlers / system / cheatsheet / $__ou_cheatsheet_cheatsheet.tid
tags: 
title: $:/ou/cheatsheet/cheatsheet
type: text/vnd.tiddlywiki

For Markdown cheatsheet, see:  $:/ou/cheatsheet/markdown

! Keyboard Shortcuts
```
<<keys "Ctrl > Space">>
```
Produces:  <<keys "Ctrl > Space">>

Don't use trailing spaces after the closing speech mark --- it breaks things due to a bug in the markdown parser.  It is OK with WikiText, but it probably best to get out of the habit of using spaces.

! Menu/UI Navigation
```
<<menu "File > Save">>
```
Produces: <<menu "File > Save">>

!File Paths
Normal inline code style using single back quotes.
<pre>&#96;T:\InfoSci\Common&#96;
</pre>
Produces: `T:\InfoSci\Common`

!Code

Triple back quotes, and the language:
<pre>&#96;&#96;&#96;java
public static void main(String...args) { }
&#96;&#96;&#96;</pre>

Produces:

```java
public static void main(String...args) { }
```

Note that for plain text (where you don't want syntax highlighting) you can use either:
<pre>&#96;&#96;&#96;
plain text goes here
&#96;&#96;&#96;</pre>

which produces:

```
plain text goes here
```

or 

<pre>&#96;&#96;&#96;plaintext
plain text goes here
&#96;&#96;&#96;</pre>

which produces:

```plaintext
plain text goes here
```

The difference is that TiddlyWiki handles the first, and the `highlight.js` plugin handles the second.  Depending on themes, they can produce output with different styles.

You will often need a blank line before/after the back quotes.

You can also use HTML `<pre>` tags with Unicode literals if your content includes things that TiddlyWiki will try to interpret (such as triple-backquotes).  Trying to display Markdown source code is a good example of this.

```
<pre>&#96;&#96;&#96;
code goes here
&#96;&#96;&#96;</pre>
```

Produces:

<pre>&#96;&#96;&#96;
code goes here
&#96;&#96;&#96;</pre>


!Diagrams
Transclude another tiddler that has SVG as its contents:

```
{{$:/ou/cheatsheet/svg_example}}
```
produces

{{$:/ou/cheatsheet/svg_example}}

Look at  $:/ou/cheatsheet/svg_example for an example of how to create an SVG tiddler.  You need to set the type to `image/svg+xml`.

! Paragraphs/Code in Lists (WikiText)

Note: The following relates to WikiText.  As a general rule, WikiText is a bit crap at doing anything complicated, so use Markdown instead.

Use triple double quotes `"""` to group paragraphs with a list item.  The quotes wrap the grouped content:

```
# """Do stuff.
Here is how to do stuff."""
# Do more stuff.
```

# """Do stuff
Here is how to do stuff."""
# Do more stuff.

This trick doesn't work with code blocks.  Use a `<div>` for grouping code in lists.  The open `<div>` goes at the ''end'' of the list item:

<pre># Here is some code:&lt;div&gt;

&#96;&#96;&#96;java
public static void main()
&#96;&#96;&#96;
&lt;/div&gt;
# That was some code.
</pre>

# Here is some code:<div>

```java
public static void main(String...args) {}
```
</div>
# That was some code.

Note^^1^^ that if worst comes to worst you can always use pure HTML for complicated lists (or anything else).

Note^^2^^ using markdown tiddlers solves many of these problems.  For anything complicated - use Markdown rather than WikiText (set the type to `text/x-markdown`).

!Indenting (WikiText)

Colons at the start of a paragraph will indent it.  Repeat for additional levels:

```
: a
:: b
::: c
:: d
: e
```
: a
:: b
::: c
:: d
: e

!! PlantUML

!!! Showing Diagram Only

```
[[plantuml[
@startuml
a -> b : do stuff
@enduml
]]]
```

Produces:

[[plantuml[
@startuml
a -> b : do stuff
@enduml
]]]

!!! Showing Diagram with Code

```
<<pudiagram 
"""
@startuml
a -> b : do stuff
@enduml
"""
>>
```

Produces:

<<pudiagram
"""
@startuml
a -> b : do stuff
@enduml
"""
>>

See:  $:/ou/macros/pudiagram for more information on the diagram+code macro.

See: http://tobibeer.github.io/tw5-plugins/#plantuml for more infromation on the PlantUML plugin.

! Handy Unicode Characters
* &#x276D; : `&#x276D;`
* &#96;&#96;&#96;:`&#96;&#96;&#96;`: Triple back quotes.  Use with `<pre>` tags for formatting things like Markdown or WikiText source code.

! Other Useful Resources
* http://tobibeer.github.io/tb5/#Markup - WikiText markup reference.