Демо Markdown для Parser 3

Преобразует Markdown разметку в HTML. Подробнее на GitHub

@USE
markdown.p

# статически
^markdown:parse[Text with [link](https://github.com "GitHub").]

# или объект класса
$markdown[^markdown::create[
	^rem{ включать внутрь разметки HTML (небезопасно) }
	$.innerHTML(0)
	^rem{ менять в тексте шорткаты на эмодзи }
	$.emoji(1)
	^rem{ заменять сочетания символов }
	$.typograph(1)
	^rem{ подсвечивать код }
	$.highlight(1)
]]

^markdown.parse[Text with [link](https://github.com "GitHub").]

Пример преобразования

Исходник

--- __Advertisement :)__ - __[highlight.js](https://highlightjs.org/)__ - The Internet's favorite JavaScript syntax highlighter supporting Node.js and the web. - __[Parser 3](https://parser.ru)__ - simple and convenient object-oriented language which allows creating good sites in short time. You will like those projects! --- # h1 Heading 8-) ## h2 Heading ### h3 Heading #### h4 Heading ##### h5 Heading ###### h6 Heading ## Paragraph Single paragraph. Paragraph text with new line. ## Horizontal Rules ____________ --- ******** ## Typographic replacements Enable typographer option to see result. (c) (C) (r) (R) (tm) (TM) (p) (P) +/- test.. test... test..... test?..... test!.... !!!!!! ???? ,, -- --- "Smartypants, double quotes" and 'single quotes' ## Emphasis **This is bold text** __This is bold text__ *This is italic text* _This is italic text_ ~~Strikethrough~~ ___This is bold-italic text___ ***This is bold-italic text*** ++Underlined text++ ==Marked text== Subscript: H~2~O, some text C~2~H~5~OH, ~~striked text~~ and strange line ~~~~~~~123~~~~~~~ Superscript: X^2^, some math: `(x + y)^2^ = x^2^ + 2xy + y^2^` Example text with Parser code `^table::create{col^#0Afirst}` ## Blockquotes > Blockquotes can also be nested... >> ...by using additional greater-than signs right next to each other... > > > ...or with spaces between arrows. ## Escaped chars Escaped 19 chars with back slash: \\ \` \* \_ \{ \} \[ \] \< \> \( \) \# \- \. \! \| \~ \= For example: `\`code\`` ## Lists Unordered + Create a list by starting a line with `+`, `-`, or `*` + Sub-lists are made by indenting 2 spaces: - Marker character change forces new list start: * Ac tristique libero volutpat at + Facilisis in pretium nisl aliquet - Nulla volutpat aliquam velit + Very easy! Ordered 1. Lorem ipsum dolor sit amet 2. Consectetur adipiscing elit 3. Integer molestie lorem at massa 1. You can use sequential numbers... 1. ...or keep all the numbers as `1.` Start numbering with offset: 57. foo 1. bar Combined + Create a list by starting a line with `+`, `-`, or `*` + Sub-lists are made by indenting 2 spaces: - Marker character change forces new list start: 1. Ac tristique libero volutpat at 2. Facilisis in pretium nisl aliquet 3. Nulla volutpat aliquam velit + Very easy! ## Code Inline `code` Indented code // Some comments var foo = function (bar) { return bar++; }; Block code "fences" ``` Sample text here... ``` Syntax highlighting ``` js var foo = function (bar) { return bar++; }; const b = 'text with\\nnew line'; console.log(foo(5)); ``` ## Tables | Option | Description | | ------ | ----------- | | data | path to data files to supply the data that will be passed into templates. | | engine | engine to be used for processing templates. Handlebars is the default. | | ext | extension to be used for dest files. | Different aligned columns | Syntax | Description | Test Text | | :--- | :----: | ---: | | Header | Title | Here's this | | Paragraph | Text | And more | ## Links [link text](https://spearance.ru) [link with title (mouse over and wait)](http://github.com/spearance/markdown-p3 "title text!") Autoconverted link without formating https://spearance.ru Disable Autoconverted link `https://github.com/spearance` ### Email To quickly turn email address into a link, enclose it in angle brackets or without them. Write me: <mail@spearance.ru> ## Images ![Minions](https://images.unsplash.com/photo-1515041219749-89347f83291a?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D) [![Some Alt attribute](https://www.parser.ru/f/1/ptic.gif "The Bird")](https://parser.ru) Like links, Images also have a footnote style syntax ![Alt text][id] With a reference later in the document defining the URL location: [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" ### Emojies > Classic markup: :angry: :blush: :broken_heart: :confused: :cry: :frowning: :heart: :imp: :innocent: :joy: :kissing: :laughing: :neutral_face: :open_mouth: :rage: :smile: :smiley: :smiling_imp: :sob: :stuck_out_tongue: :sunglasses: :sweat: :sweat_smile: :unamused: :wink: > > Shortcuts (emoticons): :-) :-( 8-) ;) :'( ### Abbreviations This is HTML abbreviation example. It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. *[HTML]: Hyper Text Markup Language

Результат


Advertisement 🙂

You will like those projects!







h1 Heading 😎

h2 Heading

h3 Heading

h4 Heading

h5 Heading
h6 Heading

Paragraph

Single paragraph.

Paragraph text
with new line.

Horizontal Rules




Typographic replacements

Enable typographer option to see result.

© © ® ® ₽ ₽ ±

test.. test… test..... test?..... test!....

!!!!!! ???? ,, —---

"Smartypants, double quotes" and 'single quotes'

Emphasis

This is bold text

This is bold text

This is italic text

This is italic text

Strikethrough

This is bold-italic text

This is bold-italic text

Underlined text

Marked text

Subscript: H2O, some text C2H5OH, striked text and strange line ~~~~~~~123~~~~~~~

Superscript: X2, some math: (x + y)2 = x2 + 2xy + y2

Example text with Parser code ^table::create{col^#0Afirst}

Blockquotes

Blockquotes can also be nested…
…by using additional greater-than signs right next to each other…
…or with spaces between arrows.

Escaped chars

Escaped 19 chars with back slash: \ ` * _ { } [ ] < > ( ) # - . ! | ~ =

For example: `code`

Lists

Unordered

Ordered

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Integer molestie lorem at massa
  1. You can use sequential numbers…
  2. …or keep all the numbers as 1.

Start numbering with offset:

  1. foo
  2. bar

Combined

Code

Inline code

Indented code

// Some comments
var foo = function (bar) {
	return bar++;
};

Block code "fences"

Sample text here…

Syntax highlighting

var foo = function (bar) {
  return bar++;
};

const b = 'text with\nnew line';

console.log(foo(5));

Tables

Option Description
data path to data files to supply the data that will be passed into templates.
engine engine to be used for processing templates. Handlebars is the default.
ext extension to be used for dest files.

Different aligned columns

Syntax Description Test Text
Header Title Here's this
Paragraph Text And more

Links

link text

link with title (mouse over and wait)

Autoconverted link without formating https://spearance.ru

Disable Autoconverted link https://github.com/spearance

Email

To quickly turn email address into a link, enclose it in angle brackets or without them.

Write me: mail@spearance.ru

Images

Minions
Some Alt attribute

Like links, Images also have a footnote style syntax

![Alt text][id]

With a reference later in the document defining the URL location:

[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"

Emojies

Classic markup: 😠 😊 💔 😕 😢 😦 ❤️ 👿 😇 😂 😗 😆 😐 😮 😡 😄 🙂 😈 😭 😛 😎 😓 😅 😒 😉

Shortcuts (emoticons): 🙂 😦 😎 😉 😢

Abbreviations

This is HTML abbreviation example.

It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.

При разработке использованы материалы markdownguide.org