Markdown syntax: Difference between revisions

From wikinotes
(Created page with "These notes are based on the base markdown spec.<br> Parsers may introduce additional features. = Documentation = <blockquote> {| class="wikitable" |- | official docs || http...")
 
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
These notes are based on the base markdown spec.<br>
These notes are based on the base markdown spec. Ideally, this should be supported by all parsers.<br>
Parsers may introduce additional features.
Parsers may introduce additional features.


Line 15: Line 15:
== Headers ==
== Headers ==
<blockquote>
<blockquote>
Headers defined using hash prefix
Headers can be defined using hash prefix, or underlines.
<syntaxhighlight lang="markdown">
<pre>
# Header 1
# Header 1
## Header 2
## Header 2
### Header 3
### Header 3
</syntaxhighlight>


Headers can also be defined with underlines.
* <code>=</code> for header-1
* <code>-</code> for header-2
<syntaxhighlight lang="markdown">
Header 1
Header 1
========
========
Line 31: Line 26:
Header 2
Header 2
--------
--------
</pre>
For underlines, the character matters
* <code>=</code> for header-1
* <code>-</code> for header-2
</blockquote><!-- Headers -->
== Text Formatting ==
<blockquote>
<syntaxhighlight lang="md">
*emphasize txt* _emphasize txt_  # <em>
**strong txt**  __strong txt__  # <strong>
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Headers -->
</blockquote><!-- Text Formatting -->


== Links ==
== Links ==
<blockquote>
<blockquote>
Automatic Links
<syntaxhighlight lang="md">
<https://wikipedia.com>
</syntaxhighlight>
External Links
<syntaxhighlight lang="md">
See [wikipedia article](https://en.wikipedia.org/wiki/Markdown).
</syntaxhighlight>
Relative Links
<syntaxhighlight lang="md">
See [other page](samesite/page)
</syntaxhighlight>


Cross-References (same-page links)
Cross-References (same-page links)
<syntaxhighlight lang="markdown">
<syntaxhighlight lang="md">
See [Official Docs][docs]
See [Official Docs][docs]


Line 44: Line 65:
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Links -->
</blockquote><!-- Links -->
== Blockquotes ==
<blockquote>
<syntaxhighlight lang="md">
a regular paragraph
> an indented
> paragraph
>
> > a double-indented paragraph
</syntaxhighlight>
</blockquote><!-- Blockquotes -->
== Images ==
<blockquote>
<syntaxhighlight lang="md">
![kittens](/path/to/kittens.png)
</syntaxhighlight>
</blockquote><!-- Images -->
== Code ==
<blockquote>
Newline+Indented text is put in a <code>pre</code> block.
<syntaxhighlight lang="md">
Checkout this function
    def foo(bar):
        print("baz")
</syntaxhighlight>
Inline code is entered between <code>`</code>s.
<syntaxhighlight lang="md">
The `def` here is foo.
</syntaxhighlight>
</blockquote><!-- Code -->


== Lists ==
== Lists ==
Line 50: Line 106:
<blockquote>
<blockquote>
Unordered lists can be defined with <code>*</code>, <code>+</code>, or <code>-</code>.
Unordered lists can be defined with <code>*</code>, <code>+</code>, or <code>-</code>.
<syntaxhighlight lang="markdown">
<syntaxhighlight lang="md">
* red
* red
+ yellow
+ yellow
Line 57: Line 113:


Ordered lists use numbers with periods.
Ordered lists use numbers with periods.
<syntaxhighlight lang="markdown">
<syntaxhighlight lang="md">
1. one
1. one
2. two
2. two
Line 66: Line 122:
=== List Items ===
=== List Items ===
<blockquote>
<blockquote>
<syntaxhighlight lang="markdown">
Long list-items with hanging indents
# Lists support hanging indents
<syntaxhighlight lang="md">
* a very long list item,
* a very long list item,
   separated across multiple
   separated across multiple
   lines
   lines
</syntaxhighlight>
Items containing quotes
<syntaxhighlight lang="md">
* then vader says
  > I am altering the deal,
  > pray I don't alter it again
</syntaxhighlight>
Items contianing code (indented by 8-spaces)
<syntaxhighlight lang="md">
* check out this function
        def foo(bar):
            print("baz")
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- List Items -->
</blockquote><!-- List Items -->
</blockquote><!-- Lists -->
</blockquote><!-- Lists -->
</blockquote><!-- Syntax -->
</blockquote><!-- Syntax -->

Latest revision as of 13:56, 19 September 2021

These notes are based on the base markdown spec. Ideally, this should be supported by all parsers.
Parsers may introduce additional features.

Documentation

official docs https://daringfireball.net/projects/markdown/syntax

Syntax

Headers

Headers can be defined using hash prefix, or underlines.

# Header 1
## Header 2
### Header 3

Header 1
========

Header 2
--------

For underlines, the character matters

  • = for header-1
  • - for header-2

Text Formatting

*emphasize txt* _emphasize txt_  # <em>
**strong txt**  __strong txt__   # <strong>

Links

Automatic Links

<https://wikipedia.com>

External Links

See [wikipedia article](https://en.wikipedia.org/wiki/Markdown).

Relative Links

See [other page](samesite/page)

Cross-References (same-page links)

See [Official Docs][docs]

## Official Documentation [docs]

Blockquotes

a regular paragraph

> an indented
> paragraph
>
> > a double-indented paragraph

Images

![kittens](/path/to/kittens.png)

Code

Newline+Indented text is put in a pre block.

Checkout this function

    def foo(bar):
        print("baz")

Inline code is entered between `s.

The `def` here is foo.

Lists

List Types

Unordered lists can be defined with *, +, or -.

* red
+ yellow
- blue

Ordered lists use numbers with periods.

1. one
2. two
3. three

List Items

Long list-items with hanging indents

* a very long list item,
  separated across multiple
  lines

Items containing quotes

* then vader says

  > I am altering the deal,
  > pray I don't alter it again

Items contianing code (indented by 8-spaces)

* check out this function

        def foo(bar):
            print("baz")