Markdown: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Markdown= =External= * Github "Mastering Markdown" https://guides.github.com/features/mastering-markdown/ =Overview= Markdown is a lightweight syntax for styling all forms...")
 
 
(45 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Markdown=
=External=
=External=


* Github "Mastering Markdown" https://guides.github.com/features/mastering-markdown/
* Github "Mastering Markdown" https://guides.github.com/features/mastering-markdown/
* https://daringfireball.net/projects/markdown/syntax
* https://commonmark.org/
=Internal=
* [[wikis]]


=Overview=
=Overview=
Line 16: Line 21:
##### This is a <h5> header
##### This is a <h5> header
</pre>
</pre>
{{Warn|There must be at least one space between '#' and the header text!}}


=Italic=
=Italic=
Line 35: Line 42:
=Colors=
=Colors=


<pre>
&lt;font color=magenta>something</font>
<font color=magenta>something</font>
 
</pre>
This does not seem to work with GitHub.
 
=Paragraph Indentation=
 
Sometimes &amp;nbsp; works:
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;


=Link=
=Link=
==Link to an External URL==


The http:// URL specified in text are automatically converted to links. Otherwise:
The http:// URL specified in text are automatically converted to links. Otherwise:


{{{
[Text](url)
[Text](url}
}}}


the URL can be absolute or relative.
the URL can be absolute or relative.


!!!Image
==Link to a Header==


{{{
The header automatically introduces anchors we can link to.
 
If the header does not contain spaces, the link should include the lower-capitalized header text ('''only the first character'''), as follows:
 
[''Link Text''](#''header'')
 
Example:
 
# Blue
[''Link Text''](#blue)
 
If the header contains spaces, all component words' first characters, including the leading word, should be lower-capitalized and linked via dashes, as follows:
 
[''Link Text''](#''lower-capitalized-header-whose-words-are-connected-by-dashes'')
 
Example:
 
# This Is a Header
[''Link Text''](#this-is-a-header)
 
=Image=
 
<pre>
![Alt Text](url)
![Alt Text](url)
}}}
</pre>


the URL can be absolute or relative.
the URL can be absolute or relative.


This syntax works in GitHub:


!!!Unnumbered List
<syntaxhighlight lang='html'>
<img src="drawing.jpg" alt="drawing" width="200"/>
</syntaxhighlight>
 
<font color=darkkhaki>
Not tested: it seems it is possible to specify the style in another file.
 
This is the markdown file:
<syntaxhighlight lang='text'>
![drawing](drawing.jpg)
</syntaxhighlight>
 
and this is the CSS:
<syntaxhighlight lang='css'>
img[alt=drawing] { width: 200px; }
</syntaxhighlight>
</font>
 
=Unnumbered List=


Use stars or dashes as follows:
Use stars or dashes as follows:


{{{
<pre>
* Item 1
* Item 1
* Item 2
* Item 2
   * Item 2a
   * Item 2a
   * Item 2b
   * Item 2b
}}}
</pre>


{{{
<pre>
- Item 1
- Item 1
- Item 2
- Item 2
   - Item 2a
   - Item 2a
   - Item 2b
   - Item 2b
}}}
</pre>


=Numbered List=


!!!Numbered List
<pre>
 
{{{
1. Item 1
1. Item 1
2. Item 2
2. Item 2
   * Item 2a
   * Item 2a
   * Item 2b
   * Item 2b
}}}
</pre>
 
This is an alternative that uses Dewey system notation:
 
<pre>
1. Item 1
2. Item 2
  2.1 Item 2.1
  2.2 Item 2.2
</pre>
 
 
To continue the numbering sequence, indent the content of a paragraph:
 
<syntaxhighlight lang='text'>
1. Item 1
2. Item 2
    This is indented and it will part
    of the numbered paragraph.
3. Item 3
</syntaxhighlight>
 
=Blockquotes=


<font color=red>
Use the '>' at the beginning of the line
!!!Blockquotes


{{{
<pre>
something and use the '>' at the beginning of the line


> this is in
> this is in
> blockquotes
> blockquotes
}}}
</pre>
 


</font>
</font>


=Inline Code=


!!!Inline Code
==Backticks==


!!Backticks
<pre>
 
{{{
blah blah blah `this will show up as code <blah>` then blah blah blah
blah blah blah `this will show up as code <blah>` then blah blah blah
}}}
</pre>


!!Four leading spaces
==Four leading spaces==


{{{
<pre>
This will show up normal and
This will show up normal and


Line 117: Line 190:


normal again
normal again
}}}
</pre>


!!Four Dashes
==Four Dashes==


<font color=red>Works in GitHub, not sure if it works generically. When I find out, update this.</font>
<font color=red>Works in GitHub, not sure if it works generically. When I find out, update this.</font>


{{{
<pre>
----
----
oc whoami
oc whoami
----
----
}}}
</pre>


!!Code Fencing (GitHub Specific)
==Code Fencing (GitHub Specific)==


Specific to GitHub, allows multiple lines without indentation:
Specific to GitHub, allows multiple lines without indentation:


{{{
<pre>
```
```
this will show up
this will show up
   as code
   as code
```
```
}}}
</pre>


For syntax highlighting, specify the language:
For syntax highlighting, specify the language:


{{{
<pre>
```javascript
```javascript
blah blah
blah blah
blah
blah
```
```
}}}
</pre>


=GitHub Specific Markdown=


==Strikethrough==


!!!GitHub Specific Markdown
<pre>
~~will be stricken through~~
</pre>


!!Strikethrough
==User Reference (Mention)==


{{{
<pre>
~~will be stroke through~~
}}}
 
!!User Reference (Mention)
 
{{{
@github-user-id
@github-user-id
}}}
</pre>


This is called an “@mention”, because you’re mentioning the individual. You can also @mention teams within an organization.
This is called an “@mention”, because you’re mentioning the individual. You can also @mention teams within an organization.


!!Task Lists
==Task Lists==


{{{
<pre>
- [x] item checked
- [x] item checked
- [x] another item checked
- [x] another item checked
- [ ] item that is not checked
- [ ] item that is not checked
}}}
</pre>


!!!Tables
=Tables=


{{{
Works in GitHub:
First Header|Second Header
------------|-------------
cell 1 | cell 2
cell 3  | cell 4
}}}


<pre>
|First Header|Second Header|Third Header|
|------------|-------------|------------|
|cell 1 | cell 2 | cell 3|
|cell 4  | cell 5 | cell 6|
</pre>


!!!Repository References
=Repository References=


!!SHA References
==SHA References==


Any reference to a commit’s SHA-1 hash will be automatically converted into a link to that commit on GitHub.
Any reference to a commit’s SHA-1 hash will be automatically converted into a link to that commit on GitHub.


{{{
<pre>
16c999e8c71134401a78d4d46435517b2271d6ac
16c999e8c71134401a78d4d46435517b2271d6ac
mojombo@16c999e8c71134401a78d4d46435517b2271d6ac
mojombo@16c999e8c71134401a78d4d46435517b2271d6ac
mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac
mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac
}}}
</pre>


 
==Issue References==
!!Issue References


Any number that refers to an Issue or Pull Request will be automatically converted into a link.
Any number that refers to an Issue or Pull Request will be automatically converted into a link.


{{{
<pre>
#1
#1
mojombo#1
mojombo#1
mojombo/github-flavored-markdown#1
mojombo/github-flavored-markdown#1
}}}
</pre>
 
=Save Markdown as PDF=
 
==Grip==
 
{{External|https://github.com/joeyespo/grip}}
 
  grip --wide --title="Custom Title" ./myfile.md
 
Go with a browser to http://localhost:6419/ and print as PDF.
 
If using Chrome, it allows adjusting margins.
 
==https://www.markdowntopdf.com==
==IntelliJ==
{{Internal|IntelliJ_Markdown_Conversion_to_Other_Formats_(incl_PDF)|Markdown Conversion to Other Formats (incl PDF) in IntelliJ}}
 
=Summary/Details Switch=
 
<syntaxhighlight lang='text'>
<details>
<summary>This will be the summary</summary>
 
```yaml
apiVersion: apps/v1
kind: Deployment
...
```
</details>
</syntaxhighlight>
=Cross-out Strikeout Text=
 
Two tildes before and after
 
<font size=-1>
~~some text~~
</font>

Latest revision as of 03:41, 6 March 2024

External

Internal

Overview

Markdown is a lightweight syntax for styling all forms of writing on the GitHub platform. It is automatically interpreted on GitHub when found in Gists, comments in Issues and Pull Requests and files with .md or .markdown extension.

Headers

# This is a <h1> header
## This is a <h2> header
...
##### This is a <h5> header

There must be at least one space between '#' and the header text!

Italic

*This text will be italic*
_This text will also be italic_

Bold

**This text will be bold**
__This text will also be bold__

Italic and bold can be combined.

Colors

<font color=magenta>something

This does not seem to work with GitHub.

Paragraph Indentation

Sometimes &nbsp; works:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

Link

Link to an External URL

The http:// URL specified in text are automatically converted to links. Otherwise:

[Text](url)

the URL can be absolute or relative.

Link to a Header

The header automatically introduces anchors we can link to.

If the header does not contain spaces, the link should include the lower-capitalized header text (only the first character), as follows:

[Link Text](#header)

Example:

# Blue

[Link Text](#blue)

If the header contains spaces, all component words' first characters, including the leading word, should be lower-capitalized and linked via dashes, as follows:

[Link Text](#lower-capitalized-header-whose-words-are-connected-by-dashes)

Example:

# This Is a Header

[Link Text](#this-is-a-header)

Image

![Alt Text](url)

the URL can be absolute or relative.

This syntax works in GitHub:

<img src="drawing.jpg" alt="drawing" width="200"/>

Not tested: it seems it is possible to specify the style in another file.

This is the markdown file:

![drawing](drawing.jpg)

and this is the CSS:

img[alt=drawing] { width: 200px; }

Unnumbered List

Use stars or dashes as follows:

* Item 1
* Item 2
  * Item 2a
  * Item 2b
- Item 1
- Item 2
  - Item 2a
  - Item 2b

Numbered List

1. Item 1
2. Item 2
   * Item 2a
   * Item 2b

This is an alternative that uses Dewey system notation:

1. Item 1
2. Item 2
   2.1 Item 2.1
   2.2 Item 2.2


To continue the numbering sequence, indent the content of a paragraph:

1. Item 1
2. Item 2
    This is indented and it will part
    of the numbered paragraph.
3. Item 3

Blockquotes

Use the '>' at the beginning of the line


> this is in
> blockquotes

Inline Code

Backticks

blah blah blah `this will show up as code <blah>` then blah blah blah

Four leading spaces

This will show up normal and

    this will show up
      as code

normal again

Four Dashes

Works in GitHub, not sure if it works generically. When I find out, update this.

----
oc whoami
----

Code Fencing (GitHub Specific)

Specific to GitHub, allows multiple lines without indentation:

```
this will show up
  as code
```

For syntax highlighting, specify the language:

```javascript
blah blah
blah
```

GitHub Specific Markdown

Strikethrough

~~will be stricken through~~

User Reference (Mention)

@github-user-id

This is called an “@mention”, because you’re mentioning the individual. You can also @mention teams within an organization.

Task Lists

- [x] item checked
- [x] another item checked
- [ ] item that is not checked

Tables

Works in GitHub:

|First Header|Second Header|Third Header|
|------------|-------------|------------|
|cell 1 | cell 2 | cell 3|
|cell 4  | cell 5 | cell 6|

Repository References

SHA References

Any reference to a commit’s SHA-1 hash will be automatically converted into a link to that commit on GitHub.

16c999e8c71134401a78d4d46435517b2271d6ac
mojombo@16c999e8c71134401a78d4d46435517b2271d6ac
mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac

Issue References

Any number that refers to an Issue or Pull Request will be automatically converted into a link.

#1
mojombo#1
mojombo/github-flavored-markdown#1

Save Markdown as PDF

Grip

https://github.com/joeyespo/grip
 grip --wide --title="Custom Title" ./myfile.md

Go with a browser to http://localhost:6419/ and print as PDF.

If using Chrome, it allows adjusting margins.

https://www.markdowntopdf.com

IntelliJ

Markdown Conversion to Other Formats (incl PDF) in IntelliJ

Summary/Details Switch

<details>
<summary>This will be the summary</summary>

```yaml
apiVersion: apps/v1
kind: Deployment
...
```
</details>

Cross-out Strikeout Text

Two tildes before and after

~~some text~~