Skip to content
Snippets Groups Projects
Commit 1c325a2c authored by Sean Madsen's avatar Sean Madsen
Browse files

relaxing code standards for markdown

parent 8e9082f3
No related branches found
No related tags found
No related merge requests found
...@@ -16,11 +16,6 @@ language is useful for: ...@@ -16,11 +16,6 @@ language is useful for:
Markdown language is mostly consistent across these platforms, but some Markdown language is mostly consistent across these platforms, but some
discrepancies do exist and should be noted below. discrepancies do exist and should be noted below.
Markdown has some redundant syntax (e.g. `*italic*` and `_italic_`).
Within CiviCRM documentation we want consistent code, so we list
***unapproved variants*** below to make it clear which syntax is preferred by
CiviCRM, especially in large guides like this one.
Basics Basics
------ ------
...@@ -31,8 +26,8 @@ Basics ...@@ -31,8 +26,8 @@ Basics
- `~~strikethrough~~` *(GitHub/Mattermost/StackExchange)* - `~~strikethrough~~` *(GitHub/Mattermost/StackExchange)*
- `<del>strikethrough</del>` *(mkdocs)* - `<del>strikethrough</del>` *(mkdocs)*
***Unapproved variants:*** Underscores for `_italics_` and `__bold__` work. But Alternate syntax: Underscores for `_italics_` and `__bold__` also work on most
please but use asterisks for consistency. platforms.
Hyperlinks Hyperlinks
...@@ -42,7 +37,7 @@ Hyperlinks ...@@ -42,7 +37,7 @@ Hyperlinks
Try [CiviCRM](https://civicrm.org) for your database. Try [CiviCRM](https://civicrm.org) for your database.
- With long URLs, the following syntax is better. - With long URLs, the following syntax is better.
See [this issue][CRM-19799] for more details. See [this issue][CRM-19799] for more details.
...@@ -50,7 +45,7 @@ Hyperlinks ...@@ -50,7 +45,7 @@ Hyperlinks
- The second line can be placed anywhere in the file. - The second line can be placed anywhere in the file.
- Optionally, if the link ID ("CRM-19799" in this case) is omitted, you - Optionally, if the link ID ("CRM-19799" in this case) is omitted, you
can use the link text ("this issue") to reference the link in the can use the link text ("this issue") to reference the link in the
second line. second line.
...@@ -67,11 +62,9 @@ line. ...@@ -67,11 +62,9 @@ line.
``` ```
This makes it easy to avoid very long lines in markdown code. As a rule of This makes it easy to avoid very long lines in markdown code. As a rule of
thumb, **keep your markdown code free of lines longer than 80 characters** thumb, keep your markdown code free of lines longer than 80 characters
where possible. where possible.
Also, please **remove trailing whitespace** from the end of markdown code.
**Double line breaks** create separate paragraphs: **Double line breaks** create separate paragraphs:
```md ```md
...@@ -82,28 +75,27 @@ This is a second. ...@@ -82,28 +75,27 @@ This is a second.
``` ```
Headings Headings
-------- --------
```md ```md
Heading 1 # Heading 1
=========
Heading 2 ## Heading 2
---------
```
***Unapproved variants:*** `# Heading 1` and `# Heading 2` also work. But please ### Heading 3
use `=` and `-` for consistency.
For headings beyond 1 and 2, the `#` syntax is okay... #### Heading 4
```
Alternate syntax (only works for h1 and h2):
```md ```md
### Heading 3 Heading 1
=========
#### Heading 4 Heading 2
---------
``` ```
***Convention:*** Each page should have one and only one *Heading 1*, ***Convention:*** Each page should have one and only one *Heading 1*,
...@@ -111,7 +103,6 @@ which should be at the top of the page as a page title. Other headings within ...@@ -111,7 +103,6 @@ which should be at the top of the page as a page title. Other headings within
page content should be level 2 or greater. page content should be level 2 or greater.
Lists Lists
----- -----
...@@ -124,32 +115,27 @@ Lists ...@@ -124,32 +115,27 @@ Lists
- Then, a third. - Then, a third.
``` ```
***Unapproved variants:*** Alternate syntax:
- Unordered lists also recognize `*` and `+` as item delimiters. - Unordered lists also recognize `*` and `+` as item delimiters.
But please use `-` for consistency.
- Markdown is somewhat flexible with the quantity and position of spaces when - Markdown is somewhat flexible with the quantity and position of spaces when
making lists, but for consistency, please stick to the example above which making lists, but using 3 spaces after the dash means that sub-lists look
has: **1 dash, 3 spaces, then content**, and has **long lines beginning nicer in code.
with 4 spaces** so they line up nicely.
### Ordered lists ### Ordered lists
```md ```md
1. Item 1. Item
2. Item 1. Item
3. Item 1. Item
``` ```
***Unapproved variants:*** Alternate syntax:
- Ordered lists items are automatically re-numbered sequentially upon display - Ordered lists items are automatically re-numbered sequentially upon display
which means all items can begin with `1`, but for the sake of consistency which means all items can begin with `1`, or they can be ordered
with existing docs, please number your lists sequentially in code. sequentially in code.
- Similar to the comment above for unordered lists, please keep all list
content beginning 4 characters in, which means a digit character, a period,
then two spaces, then content.
### Nested lists ### Nested lists
...@@ -201,7 +187,7 @@ BLOCK ...@@ -201,7 +187,7 @@ BLOCK
*Fenced code can use more backticks when necessary to represent code with *Fenced code can use more backticks when necessary to represent code with
3 backticks (which is what you'd see in the source for this page).* 3 backticks (which is what you'd see in the source for this page).*
***Unapproved variants:*** For fenced code, the tilde `~` character also works Alternate syntax: For fenced code, the tilde `~` character also works
in place of the backtick character but should be avoided for consistency. in place of the backtick character but should be avoided for consistency.
...@@ -245,15 +231,15 @@ A block of **"indented code"** with four spaces at the start of each line: ...@@ -245,15 +231,15 @@ A block of **"indented code"** with four spaces at the start of each line:
`swift`, `tex`, `thor`, `v`, `vb`, `vbnet`, `vbs`, `vbscript`, `veo`, `swift`, `tex`, `thor`, `v`, `vb`, `vbnet`, `vbs`, `vbscript`, `veo`,
`xhtml`, `xml`, `xsl`, `yaml`, `zsh` `xhtml`, `xml`, `xsl`, `yaml`, `zsh`
- Syntax highlighting cannot be forced for indented code. - Syntax highlighting cannot be forced for indented code.
- Syntax highlighting is not available for inline code. - Syntax highlighting is not available for inline code.
- [Stack Exchange syntax highlighting][stack exchange syntax highlighting] is - [Stack Exchange syntax highlighting][stack exchange syntax highlighting] is
done differently. done differently.
[stack exchange syntax highlighting]: http://stackoverflow.com/editing-help#syntax-highlighting [stack exchange syntax highlighting]: http://stackoverflow.com/editing-help#syntax-highlighting
### Code blocks within lists ### Code blocks within lists
You can use **indented code within lists** by keeping a blank line You can use **indented code within lists** by keeping a blank line
above/below and indenting *4 spaces more than your list content*, like this: above/below and indenting *4 spaces more than your list content*, like this:
```md ```md
...@@ -303,7 +289,7 @@ point and with alt text in place of the link text. ...@@ -303,7 +289,7 @@ point and with alt text in place of the link text.
![Alt text](image.png) ![Alt text](image.png)
``` ```
or or
```md ```md
![Alt text][id] ![Alt text][id]
...@@ -332,7 +318,7 @@ External references ...@@ -332,7 +318,7 @@ External references
- [Mattermost markdown](https://docs.mattermost.com/help/messaging/formatting-text.html) - [Mattermost markdown](https://docs.mattermost.com/help/messaging/formatting-text.html)
- [Stack Exchange markdown](http://stackoverflow.com/editing-help) - [Stack Exchange markdown](http://stackoverflow.com/editing-help)
- [GitHub markdown](https://help.github.com/categories/writing-on-github/) - [GitHub markdown](https://help.github.com/categories/writing-on-github/)
- [Official markdown reference](https://daringfireball.net/projects/markdown/syntax) - [Official markdown reference](https://daringfireball.net/projects/markdown/syntax)
(though somewhat difficult to read) (though somewhat difficult to read)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment