Markdown: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 93: Line 93:


the URL can be absolute or relative.
the URL can be absolute or relative.
This syntax works in GitHub:
<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=
=Unnumbered List=
Line 207: Line 227:


<pre>
<pre>
~~will be stroke through~~
~~will be stricken through~~
</pre>
</pre>


Line 231: Line 251:


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


Line 288: Line 308:
</details>
</details>
</syntaxhighlight>
</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~~