pages: markdown: update the examples

This commit is contained in:
He4eT 2025-04-20 03:01:36 +02:00
commit 593c7f201e

View file

@ -19,7 +19,7 @@ filters — including [Setext](http://docutils.sourceforge.net/mirror/setext.htm
[Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) — the single biggest source of [Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) — the single biggest source of
inspiration for Markdown's syntax is the format of plain text email. inspiration for Markdown's syntax is the format of plain text email.
**Note:** This document is itself written using Markdown **Note:** This document is itself written using Markdown.
--- ---
@ -37,7 +37,6 @@ inspiration for Markdown's syntax is the format of plain text email.
* [Emphasis](#emphasis) * [Emphasis](#emphasis)
* [Code](#code) * [Code](#code)
--- ---
## Block Elements ## Block Elements
@ -60,14 +59,9 @@ end a line with two or more spaces, then type return.
### Headers ### Headers
Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. Headers are lines that start with the `#` symbol.
The number of characters defines the header level,
Optionally, you may "close" atx-style headers. This is purely from one (`#`) for `<h1>` to six (`######`) for `<h6>`.
cosmetic — you can use this if you think it looks better. The
closing hashes don't even need to match the number of hashes
used to open the header. (The number of opening hashes
determines the header level.)
### Blockquotes ### Blockquotes
@ -105,20 +99,20 @@ adding additional levels of `>`:
Blockquotes can contain other Markdown elements, including headers, lists, Blockquotes can contain other Markdown elements, including headers, lists,
and code blocks: and code blocks:
> ## This is a header. > ### Here's a list
> >
> 1. This is the first list item. > 1. This is the first list item.
> 2. This is the second list item. > 2. This is the second list item.
> >
> Here's some example code: > ### Here's an example code block
> > ```
> return shell_exec("echo $input | $markdown_script"); > const PI = 3.1415`
> ```
Any decent text editor should make email-style quoting easy. For Any decent text editor should make email-style quoting easy. For
example, with BBEdit, you can make a selection and choose Increase example, with BBEdit, you can make a selection and choose Increase
Quote Level from the Text menu. Quote Level from the Text menu.
### Lists ### Lists
Markdown supports ordered (numbered) and unordered (bulleted) lists. Markdown supports ordered (numbered) and unordered (bulleted) lists.
@ -220,13 +214,14 @@ delimiters need to be indented:
> inside a list item. > inside a list item.
To put a code block within a list item, the code block needs To put a code block within a list item, the code block needs
to be indented *twice* — 8 spaces or two tabs: to be indented with list item indentation in mind:
* A list item with a code block: * A list item with a code block:
``` ```
code goes here
code goes here code goes here
``` ```
### Code Blocks ### Code Blocks
@ -235,62 +230,65 @@ markup source code. Rather than forming normal paragraphs, the lines
of a code block are interpreted literally. Markdown wraps a code block of a code block are interpreted literally. Markdown wraps a code block
in both `<pre>` and `<code>` tags. in both `<pre>` and `<code>` tags.
To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab.
This is a normal paragraph:
This is a code block.
Here is an example of AppleScript:
tell application "Foo"
beep
end tell
A code block continues until it reaches a line that is not indented
(or the end of the article).
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
are automatically converted into HTML entities. This makes it very
easy to include example HTML source code using Markdown — just paste
it and indent it, and Markdown will handle the hassle of encoding the
ampersands and angle brackets. For example, this:
<div class="footer">
&copy; 2004 Foo Corporation
</div>
Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.
``` ```
tell application "Foo" tell application "Foo"
beep beep
end tell end tell
``` ```
Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.
```
## This is **not** a Markdown
```
### Tables ### Tables
| Column 1 | Column 2 | Column 3 | Markdown tables are created using pipes (|) to separate columns and hyphens (-) to define the header row. Heres the basic structure:
| :------------- | :----------: | -----------: |
| Cell Contents | More Stuff | And Again | 1. Header Row: The first row contains column names.
| You Can Also | Put Pipes In | Like this [\|] | 2. Divider Line: The second row uses hyphens to separate the header from the data.
3. Data Rows: The rows below the divider contain the actual data.
| Name | Age | City |
|-------|-----|-------|
| Alice | 25 | New York |
| Bob | 30 | London |
You can style text inside Markdown table cells just like regular Markdown.
This includes making text bold, italic, monospaced, or adding links or code.
Column 1 | Column 2 | Column 3 Column 1 | Column 2 | Column 3
--- | --- | --- --- | --- | ---
**Things** | _Don't_ | [Need](/) **Things** | _Don't_ | [Need](/)
To | *__Look__* | `Pretty` To | *__Look__* | `Pretty`
You can align text in Markdown table columns to the left, right, or center by placing a colon (:) in different positions within the header divider row.
1. Left-aligned: `:---` (Colon on the left)
2. Right-aligned: `---:` (Colon on the right)
3. Center-aligned: `:---:` (Colons on both sides)
| Column 1 | Column 2 | Column 3 |
| :------------- | :----------: | -----------: |
| Cell Contents | More Stuff | And Again |
| You Can Also | Put Pipes In | Like this [\|] |
Markdown tables dont support merging cells (like in HTML).
Each cell is treated separately.
But if you want an empty space, just leave it blank.
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | |
| Cell 3 | Cell 4 |
## Span Elements ## Span Elements
### Links ### Links
Markdown supports two style of links: *inline* and *reference*.
In both styles, the link text is delimited by [square brackets].
To create an inline link, use a set of regular parentheses immediately To create an inline link, use a set of regular parentheses immediately
after the link text's closing square bracket. Inside the parentheses, after the link text's closing square bracket. Inside the parentheses,
put the URL where you want the link to point, along with an *optional* put the URL where you want the link to point, along with an *optional*
@ -298,7 +296,7 @@ title for the link, surrounded in quotes. For example:
This is [an example](http://example.com/) inline link. This is [an example](http://example.com/) inline link.
[This link](/example) has no title attribute. [This link](/test/markdown/ "This is an example title") has a title attribute.
### Emphasis ### Emphasis