Forum text markup

Summary

Test of the forum markup.

This post is me testing the formatting options of the forum. I tried to make it informative while testing things, so hopefully it can be of use to new forum members as well.


Escaping formatting symbols

To display characters used for formatting, they may need to be escaped using \ (like when not used inside a code block).
*test* is written using \test\

Headers

Headers are rows staring with one to six #, just like <h1> to <h6> in html. The header for this section is using ### Headers

Basic text formatting

Text surrounded by one to three stars or underscores makes them (in order):

  1. Text surrounded by one underscore or star makes it italics
  2. Two stars or underscores makes it bold
  3. Three makes it both bold and italics

Fixed width text

blockquotes start with a >

Preformatted text

Non-code preformatted text starts with four spaces (need one blank row before and after):

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret home_latitude
  longitude: !secret home_longitude

Inline code

Inline code has backquotes surrounding it, like `this`

Codeblocks

Three backquotes marks blocks of code. For yaml markup, we should normally use ```yaml at top and ``` at the bottom of the code block. This doesn’t seem to change much, but we still get comments hilighted differently than the rest.

#YAML hilighting example
homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret home_latitude
  longitude: !secret home_longitude

For some reason get a different result if we have a doublequoted (string) value in our yaml.

#YAML hilighting example #2
homeassistant:
  # Name of the location where Home Assistant is running
  name: "Home"
  # Location required to calculate the time the sun rises and sets
  latitude: !secret home_latitude
  longitude: !secret home_longitude

This makes me suspect that yaml is missing a correct hilighting implementation at the moment. But I think it’s probably good to use ```yaml anyway, in case it gets’s implemented at a later point in time.

Other language examples:

#```python
s = "Python syntax highlighting"
print
//```javascript
var s = "JavaScript syntax highlighting";
alert(s);

Tables

Tables doesnt seem to work like in the cheatsheet :disappointed:, but they mention that “Tables aren’t part of the core Markdown spec”. (I put it as preformatted below, but it doesn’t work without it either).

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

Lists

  1. Lists can be either ordered or unordered.
  2. Sublists can be made as a different type than the parent item.
  • Subitems / lists inside lists
    • Subitems are indented with spaces

Note: Two lists after another needs to be separated by a non-list item or they will end up as one list. If you don’t want any visible text to separate them you can use an empty codeblock: `` with an empty row above and below it.

  • Bullet list marked with *
  • Marking with a dash works too.
    • indented one level, 2 spaces
      • two levels, 4 spaces
        • three… takes 8 spaces
          text keeps its indentation like the last point until
          one extra blank line is used
3 Likes

FWIW, there’s a Discourse sandbox here which you can use for this sort of thing. :slight_smile:

2 Likes

Ah, good to know for future testing. I didn’t even consider using the discourse site for things like that.