Do you know all the cool stuff you can do on SSW Rules?

Last updated by Tiago Araújo [SSW] 12 days ago.See history

This is an example rule + Markdown cheatsheet to give you some guidance around how to write rules and show you the things you can use to format an SSW rule.

Concepts to write rules

There are a few concepts that are applied to structure most SSW Rules:

  1. Show the pain - Usually in the intro, explain the problem and context around why that rule exists
  2. Give good and bad examples - Include practical examples for people to better understand the concepts. Using images is usually the best way to go
  3. Explain the why, not the how - A rule isn't a place to document how to use a 3rd party product. You should focus on the reasons why we do something, and then link to external documentation on how to do something

See a few examples of SSW Rules that follow the structure of good and bad examples, then link off to external documentation for more information:

1. Headings, paragraphs, and blockquotes

## This is a heading 2 (We never use heading 1 in SSW Rules Content to improve SEO, that's because the title is already a heading 1)

### This is a heading 3

#### This is a heading 4

##### This is a heading 5

###### This is a heading 6 and below is a blockquote

\> \*Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.  
\>  \- Someone famous in Source Title

Figure: Markdown to generate headings and blockquotes

::: info Do not use heading 1 content - the title is already a heading 1, and we should avoid using multiple <h1> elements on one page. :::

This is a heading 2

Lorem ipsum dolor sit amet. Ut enim ad minim veniam, quis nostrud exercitation. qui officia deserunt mollit anim id est laboru.

This is a heading 2 with some emphasized text by making it bold

Tip: See text decoration section for more details on making the text bold.

This is a heading 3

Lorem ipsum dolor sit amet. Ut enim ad minim veniam, quis nostrud exercitation. qui officia deserunt mollit anim id est laboru.

This is a heading 4

Lorem ipsum dolor sit amet. Ut enim ad minim veniam, quis nostrud exercitation. qui officia deserunt mollit anim id est laboru.

This is a heading 5

Lorem ipsum dolor sit amet. Ut enim ad minim veniam, quis nostrud exercitation. qui officia deserunt mollit anim id est laboru.

This is a heading 6

Lorem ipsum dolor sit amet. Ut enim ad minim veniam, quis nostrud exercitation. qui officia deserunt mollit anim id est laboru.

...and this is a blockquote:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

> * Someone famous in Source Title

---

2. Text decorations

_This text will be italic_
_This will also be italic_

**This text will be bold**
**This will also be bold**

_You **can** combine them_

\~\~strikethrough\~\~

<mark>These words</mark> are surrounded by a &lt;mark&gt; (HTML needed)

Figure: Markdown to generate different text styles

This text will be italic
This will also be italic

This text will be bold
This will also be bold

~~strikethrough~~

You can combine them

<mark>These words</mark> are surrounded by a <mark> (HTML needed)

---

3. Lists

#### Unordered lists

- This is the first item of an unordered list
- This is the second item of an unordered list
  1.  This is the first item of an ordered list inside an unordered list
  2.  This is the second item of an ordered list inside an unordered list
- This is the third item of an unordered list
  - This is the first item of an unordered list inside another
  - This is the second item of an unordered list inside another
    1. This is the first item of an ordered list inside a nested unordered list
    2. This is the second item of an ordered list inside a nested unordered list

#### Ordered lists

1. This is the first item of an ordered list
2. This is the second item of an ordered list
3. This is the third item of an ordered list
   - This is the first item of an unordered list inside an ordered list
   - This is the second item of an unordered list inside an ordered list
     1. This is the first item of an ordered list inside another
     2. This is the second item of an ordered list inside another

Figure: Markdown to generate lists

Unordered lists

  • This is the first item of an unordered list
  • This is the second item of an unordered list
    1. This is the first item of an ordered list inside an unordered list
    2. This is the second item of an ordered list inside an unordered list
  • This is the third item of an unordered list
    • This is the first item of an unordered list inside another
    • This is the second item of an unordered list inside another
      1. This is the first item of an ordered list inside a nested unordered list
      2. This is the second item of an ordered list inside a nested unordered list

Ordered lists

  1. This is the first item of an ordered list
  2. This is the second item of an ordered list
  3. This is the third item of an ordered list
    • This is the first item of an unordered list inside an ordered list
    • This is the second item of an unordered list inside an ordered list
      1. This is the first item of an ordered list inside another
      2. This is the second item of an ordered list inside another

---

4. Links

[link text](https://www.url.com "link title")

Figure: Markdown to generate links

This is an internal link.

This is an internal link with title (hover me).

This is an external link.

::: greybox Cool link features:

:::

---

5. Boxes

::: greybox  
This is a box using the class "greybox".  
:::

Figure: Markdown to generate boxes

::: greybox
This is a box using the class "greybox".
:::

::: highlight
This is a box using the class "highlight". :::

::: highlight

This is an example of a heading in a highlight

:::

::: info
This is a <div> using the class "info". Works the same as using a <p> . Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
:::

::: info

This is an example of a heading in a info

:::

::: china
This is a <div> using the class "china". Works the same as using a <p> . Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::

::: china

This is an example of a heading in a china

:::

::: codeauditor This is a <div> using the class "codeauditor". Works the same as using a <p> . Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::

::: codeauditor

This is an example of a heading in a codeauditor

:::

::: todo
This is a <div> using the class "todo". Works the same as using a <p> . Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
:::

Hiding content

Use the class "hidden" to hide content.

::: hidden  
bfb265e3-644e-4cbe-b17c-4d378b014809-7947936  
:::

Figure: Nothing will show up from this Markdown

---

6. Images

::: img-small  
\![Figure: Caption text](image-file.jpg)
:::

::: img-small
!Figure: Image using class "img-small" :::

::: img-medium
!Figure: Image using class "img-medium" :::

::: img-large
!Figure: Image using class "img-large" :::

::: no-border !Figure: Image without border :::

!Figure: How a smaller image (400px) works with long caption. Full screen on mobile, real width on larger screens

!Figure: ..and with a short caption

::: todo
TODO: Make these images hosted internally as per Do you make sure your images are hosted internally? :::

---

7. Captions

::: bad  
Figure: Caption for bad examples
:::

::: ok  
Figure: Caption for OK examples
:::

::: good  
Figure: Caption for good examples
:::

Captions on images

::: bad
!Figure: Caption for bad images :::

!Figure: Caption for regular images

::: ok
!Figure: Caption for OK images :::

::: good
!Figure: Caption for good images :::

Captions on boxes

::: greybox
This is an example of a bad grey box.
:::
::: bad
Figure: Caption for bad examples :::

::: greybox
This is an example of a normal grey box. :::
Figure: Caption for normal examples

::: greybox
This is an example of a OK grey box. :::
::: ok
Figure: Caption for ok examples
:::

::: greybox
This is an example of a good grey box. :::
::: good
Figure: Caption for good examples
:::

---

8. Videos

Code for videos

`youtube: https://www.youtube.com/embed/0ugMkda9IBw`
**Video: Top 5 Reasons Why ASP.NET MVC is Great (3 min)**

Figure: Markdown to add videos and video captions

Example

Check out this video - it's responsive!

youtube: https://www.youtube.com/embed/0ugMkda9IBw Video: Top 5 Reasons Why ASP.NET MVC is Great (3 min)

---

9. Twitter Cards Embed

Embedding a Tweet is similar to a video. Copy the link of the tweet then add it to the rule with backticks on each side like this:

`oembed: https://twitter.com/MrHinsh/status/24123713864`

oembed: https://twitter.com/MrHinsh/status/24123713864

---

10. Code

To include code block in Markdown, start with 3 backticks <code>```</code> on a new line, write or paste your code, and then end with 3 backticks on a new line.

For syntax highlighting in code blocks, add the language name right after the opening backticks. Learn more on Markdown – Do you set the language on code blocks?

To add inline code in Markdown, wrap the code snippet with single backticks. See this text as inline code for example.

This is a piece of code in a code block

::: bad
Figure: Bad example - Because this code doesn't include the language used :::

See this json file for all supported languages and their aliases we can use in SSW Rules. See some examples:

let iceCream = "chocolate";
if (iceCream === "chocolate") \{
  alert("Yay, I love chocolate ice cream\!");
\} else \{
  alert("Awwww, but chocolate is my favorite...");
\}

Figure: Javascript code block

IF EXISTS (SELECT 1 FROM
               INFORMATION_SCHEMA.TABLES
           WHERE
               TABLE_TYPE='BASE TABLE' AND
               TABLE_NAME='Employees'
           )
    ALTER TABLE [dbo].[Employees]( …… ) ON [PRIMARY]
ELSE
    CREATE TABLE [dbo].[Employees]( …… ) ON [PRIMARY]

Figure: SQL code block

public class MyClass
\{
    public string  myField = string.Empty;

    public MyClass()
    \{
    \}

    public void MyMethod(int parameter1, string parameter2)
    \{
        Console.WriteLine("First Parameter \{0\}, second parameter \{1\}",
                                                    parameter1, parameter2);
    \}

    public int MyAutoImplementedProperty \{ get; set; \}

    private int myPropertyVar;

    public int MyProperty
    \{
        get \{ return myPropertyVar; \}
        set \{ myPropertyVar = value; \}
    \}
\}

Figure: C Sharp code block

\{
  "glossary": \{
    "title": "example glossary",
    "GlossDiv": \{
      "title": "S",
      "GlossList": \{
        "GlossEntry": \{
          "ID": "SGML",
          "SortAs": "SGML",
          "GlossTerm": "Standard Generalized Markup Language",
          "Acronym": "SGML",
          "Abbrev": "ISO 8879:1986",
          "GlossDef": \{
            "para": "A meta-markup language, used to create markup languages such as DocBook.",
            "GlossSeeAlso": ["GML", "XML"]
          \},
          "GlossSee": "markup"
        \}
      \}
    \}
  \}
\}

Figure: JSON code block

---

11. Email Templates

Code for email template

::: email-template  
| | |
| \-\-\-\-\-\-\-\- | \-\-\- |
| To: | XXX |
| Cc: | YYY |
| Bcc: | ZZZ |
| Subject: | \{\{ EMAIL SUBJECT \}\} |  
::: email-content

### Hi XXX,

\{\{ EMAIL CONTENT \}\}

:::  
:::  
::: good  
Figure: Good example - Nice email template  
:::

Figure: Markdown for email templates

::: email-template

| | | | -------- | ------------------- | | To: | XXX | | Cc: | YYY | | Bcc: | ZZZ | | Subject: | {{ EMAIL SUBJECT }} |

::: email-content

Hi XXX

{{ EMAIL CONTENT }}

:::
:::
::: good
Figure: Good example - Nice email template
:::

---

12. Tables

Code for tables

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

Figure: Markdown to generate tables

Examples

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

| Markdown | Less | Pretty | | -------- | --------- | ---------- | | Still | renders | nicely | | 1 | 2 | 3 |

---

13. Thematic breaks (horizontal rules)

Code for hr

\-\-\-

Examples

---

Christian Morford-Waite
Sebastien Boissiere
Tiago Araujo
Brady Stroud
Adam Cogan
We open source. Powered by GitHub