Repository: hexojs/hexo-renderer-markdown-it
Branch: master
Commit: 0c5034e87fff
Files: 27
Total size: 95.7 KB
Directory structure:
gitextract_pxi85g_4/
├── .eslintignore
├── .eslintrc
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ └── tester.yml
├── .gitignore
├── .mocharc.yml
├── LICENSE
├── README.md
├── index.js
├── lib/
│ ├── anchors.js
│ ├── images.js
│ └── renderer.js
├── package.json
└── test/
├── .eslintrc
├── fixtures/
│ ├── markdownit.md
│ └── outputs/
│ ├── anchors.html
│ ├── commonmark-deprecated.html
│ ├── commonmark.html
│ ├── custom.html
│ ├── default-disable_rules.html
│ ├── default.html
│ ├── plugins.html
│ ├── zero-enable_rules.html
│ └── zero.html
├── index.js
└── scripts/
└── enable_unsafe_link.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintignore
================================================
node_modules/
coverage/
tmp/
================================================
FILE: .eslintrc
================================================
{
"extends": "hexo",
"root": true
}
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
*.cs text diff=csharp
*.java text diff=java
*.html text diff=html
*.css text
*.js text
# absolute paths are ok, as are globs
test/**/* text eol=lf
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: monthly
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
open-pull-requests-limit: 3
================================================
FILE: .github/workflows/tester.yml
================================================
name: Tester
on: [push, pull_request]
jobs:
tester:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['14.x', '16.x', '18.x']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-npm-cache
restore-keys: ${{ runner.os }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test
env:
CI: true
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: ['14.x']
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-npm-cache
restore-keys: ${{ runner.os }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Coverage
run: npm run test-cov
env:
CI: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
================================================
FILE: .gitignore
================================================
.DS_Store
node_modules/
tmp/
*.log
.idea/
coverage/
package-lock.json
================================================
FILE: .mocharc.yml
================================================
color: true
================================================
FILE: LICENSE
================================================
Copyright (c) 2015 Celso Miranda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# hexo-renderer-markdown-it
[](https://github.com/hexojs/hexo-renderer-markdown-it/actions?query=workflow%3ATester)
[](https://www.npmjs.com/package/hexo-renderer-markdown-it)
[](https://coveralls.io/github/hexojs/hexo-renderer-markdown-it?branch=master)
This renderer plugin uses [Markdown-it] as a render engine on [Hexo]. Adds support for [Markdown] and [CommonMark].
## Main Features
- Support for [Markdown], [GFM] and [CommonMark]
- Extensive configuration
- Faster than the default renderer | `hexo-renderer-marked`
- Safe ID for headings
- Anchors for headings with ID
- Footnotes
- `<sub>` H<sub>2</sub>O
- `<sup>` x<sup>2</sup>
- `<ins>` <ins>Inserted</ins>
## Installation
**Warning:** make sure you're inside the main hexo directory before starting this guide.
A default Hexo installation will include a markdown renderer plugin which uses `marked`, so you will have to remove it if you want to use `hexo-renderer-markdown-it`.
``` sh
$ npm un hexo-renderer-marked --save
```
If you have already removed the default renderer, and others you might of added, you can now safely install `hexo-renderer-markdown-it`
``` sh
$ npm i hexo-renderer-markdown-it --save
```
## Options
``` yml
markdown:
preset: 'default'
render:
html: true
xhtmlOut: false
langPrefix: 'language-'
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
enable_rules:
disable_rules:
plugins:
anchors:
level: 2
collisionSuffix: ''
permalink: false
permalinkClass: 'header-anchor'
permalinkSide: 'left'
permalinkSymbol: '¶'
case: 0
separator: '-'
images:
lazyload: false
prepend_root: false
post_asset: false
inline: false # https://markdown-it.github.io/markdown-it/#MarkdownIt.renderInline
```
See below for more details.
## Advanced Configuration
### [Preset](https://markdown-it.github.io/markdown-it/#MarkdownIt.new) options
``` yml
markdown:
preset: 'default'
```
- **"commonmark"** - configures parser to strict [CommonMark](https://commonmark.org/) mode.
- **"default"** - similar to [GFM](https://github.github.com/gfm/), used when no preset name given. Enables all available rules, but still without html, typographer & autolinker.
- **"zero"** - all rules disabled. Useful to quickly setup your config via `.enable()`. For example, when you need only `bold` and `italic` markup and nothing else.
Note that the [default](https://github.com/hexojs/hexo-renderer-markdown-it#options) render and anchor options override some options in the preset. If you prefer to have the preset only:
``` yml
markdown:
preset: 'default'
render:
anchors:
```
### Render options
#### html
The `html` setting defines whether or not HTML content inside the document should be escaped or passed to the final result.
``` yaml
html: true # Doesn't escape HTML content
## OR
html: false # Escapes HTML content so the tags will appear as text.
```
#### xhtmlOut
The `xhtmlOut` setting defines whether the parser will export fully XHTML compatible tags. This only needs to be `true` for complete [CommonMark] support.
``` yaml
xhtmlOut: true # Parser produces fully XHTML compliant code.
# Ex: A line breaks will be <br />
## OR
xhtmlOut: false # Parser will not produce XHTML compliant code.
# Ex: A line break will be <br>
```
#### breaks
Makes line breaks in the source file will be parsed into `<br>` tags. So every time you press the `Enter` key you will create a line break, which is not the default Markdown, CommonMark, or GFM behaviour.
``` yaml
breaks: true # Parser produces `<br>` tags every time there is a line break in the source document.
## OR
breaks: false # Parser will ignore line breaks in the source document.
#Default double line break creates paragraph is still supported
```
#### langPrefix
Add a prefix to the class name of code blocks (when a language is specified).
``` yaml
langPrefix: 'language-' # default
```
_This option only applies when both Hexo's built-in highlighters are [**disabled**](https://hexo.io/docs/syntax-highlight#Disabled)._
**Example:**
``` yml
langPrefix: 'lang-'
```
Source:
````
``` js
example
```
````
HTML:
```html
<pre>
<code class="lang-js">example</code>
</pre>
```
#### linkify
The parser has the ability to inline links pasted directly into the text. If you write a piece of text that looks like a link it will be rendered as `<a src="http://example.com">http://example.com</a>`.
``` yaml
linkify: true # Returns text links as proper links inlined with the paragraph.
## OR
linkify: false # Returns text links as text.
```
#### typographer
This is enables the substitution for common typography elements like ©, curly quotes, dashes, etc.
``` yaml
typographer: true # Substitution of common typographical elements will take place.
## OR
typographer: false # No substitution, so dumb quotes will remain dumb quotes, etc.
```
#### quotes
Defines the double and single quotes used for substituting dumb quotes if typographer is set to `true`.
``` yaml
quotes: '“”‘’' # "double" will be turned into “single”
# 'single' will be turned into ‘single’
## OR
quotes: '«»“”' # "double" will be turned into «single»
# 'single' will be turned into “single”
```
#### Example configuration
``` yaml
markdown:
render:
html: true
xhtmlOut: false
breaks: false
linkify: true
typographer: true
quotes: '“”‘’'
```
### Manage rules
Certain rules are enabled or disabled depending on the [preset](#preset-options). For example, "zero" preset disables all rules, to enable specific rules:
``` yml
markdown:
preset: 'zero'
# Single rule
enable_rules: 'link'
# Multiple rules
enable_rules:
- 'link'
- 'image'
```
"default" preset enables all rules, to disable specific rules:
``` yml
markdown:
preset: 'default'
# Single rule
disable_rules: 'link'
# Multiple rules
disable_rules:
- 'link'
- 'image'
```
#### Available rules
Since the rules are subject to change, it's better to check the Markdown-it's source code for up-to-date rules. Look for the `_rules` variable in the following files:
- [parser_block.js](https://github.com/markdown-it/markdown-it/blob/master/lib/parser_block.js)
- [parser_core.js](https://github.com/markdown-it/markdown-it/blob/master/lib/parser_core.js)
- [parser_inline.js](https://github.com/markdown-it/markdown-it/blob/master/lib/parser_inline.js)
### Automatic Headline ID's
Enables you to automatically create ID's for the headings so you can link back to them. A valid html document cannot have two elements with duplicate id value, for example if `title` id is already used, subsequent `title` values will be updated to `title-2`, `title-3` and so on.
Default options:
``` yaml
markdown:
anchors:
# Minimum level for ID creation. (Ex. h2 to h6)
level: 2
# A suffix that is prepended to the number given if the ID is repeated.
collisionSuffix: ''
# If `true`, creates an anchor tag with a permalink besides the heading.
permalink: false
# Class used for the permalink anchor tag.
permalinkClass: header-anchor
# Set to 'right' to add permalink after heading
permalinkSide: 'left'
# The symbol used to make the permalink
permalinkSymbol: ¶
# Transform anchor to (1) lower case; (2) upper case
case: 0
# Replace space with a character
separator: '-'
```
### Plugins
Included plugins:
- markdown-it-abbr
- markdown-it-attrs
- markdown-it-cjk-breaks
- markdown-it-container
- markdown-it-deflist
- markdown-it-emoji
- markdown-it-footnote
- markdown-it-ins
- markdown-it-mark
- markdown-it-sub
- markdown-it-sup
Plugins are not enabled by default, to enable:
``` yaml
markdown:
plugins:
- markdown-it-abbr
# installed external plugins also can be enabled
- markdown-it-table-of-contents
```
#### Plugin option
``` yaml
markdown:
plugins:
- name: 'markdown-it-emoji'
options:
shortcuts:
laughing: ':D'
- name: 'other-plugin'
options: ...
```
## Extensibility
This plugin overrides some default behaviors of how markdown-it plugin renders the markdown into html, to integrate with the Hexo ecosystem. It is possible to override this plugin too, without resorting to forking the whole thing.
For example, to enable [unsafe links](https://markdown-it.github.io/markdown-it/#MarkdownIt.prototype.validateLink) (which is disabled by default):
``` js
hexo.extend.filter.register('markdown-it:renderer', function(md) {
const { config } = this; // Optional, parse user config from _config.yml
md.validateLink = function() { return true; };
});
// Specify custom function in plugin option
const { slugize } = require('hexo-util');
const opts = hexo.config.markdown.anchors;
const mdSlugize = (str) => {
return slugize(str, { transform: opts.case, ...opts });
};
hexo.extend.filter.register('markdown-it:renderer', function(md) {
md.use(require('markdown-it-table-of-contents'), {
includeLevel: [2,3,4],
slugify: mdSlugize
});
});
```
Save the file in "scripts/" folder and run Hexo as usual.
Refer to markdown-it [API documentation](https://markdown-it.github.io/markdown-it/#MarkdownIt).
## Frequently Asked Questions
### Missing Styles of GFM Task Lists
In general, adding the following styles to the theme can solve the problem.
```css
li.task-list-item {
list-style-type: none;
}
li.task-list-item .task-list-item-checkbox {
margin: 0 0.2em 0.25em -1.6em;
}
```
### How can I add math support?
First, install KaTeX plugin for markdown-it.
```bash
npm install katex @renbaoshuo/markdown-it-katex
```
Then add [`@renbaoshuo/markdown-it-katex`](https://github.com/renbaoshuo/markdown-it-katex) to plugins list.
```yaml
plugins:
- '@renbaoshuo/markdown-it-katex'
# Other plugins...
```
If you need to allow spaces before and after delimiters (e.g. `$ 1 + 1 = 2 $`), set the `skipDelimitersCheck` option to `true`:
```yaml
plugins:
- name: '@renbaoshuo/markdown-it-katex'
options:
skipDelimitersCheck: true
```
Don't forget to include the KaTeX stylesheet in your html:
```html
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css"
/>
```
### How can I merge table cells with the same content?
Install the [`markdown-it-merge-cells`](https://github.com/Menci/markdown-it-merge-cells) plugin.
```bash
npm install markdown-it-merge-cells
```
Then add the plugin to plugins list.
```yaml
plugins:
- markdown-it-merge-cells
# Other plugins...
```
## Requests and bug reports
If you have any feature requests or bugs to report, you're welcome to [file an issue](https://github.com/hexojs/hexo-renderer-markdown-it/issues).
[CommonMark]: http://commonmark.org/
[Markdown]: http://daringfireball.net/projects/markdown/
[GFM]: https://help.github.com/articles/github-flavored-markdown/
[Markdown-it]: https://github.com/markdown-it/markdown-it
[Hexo]: http://hexo.io/
================================================
FILE: index.js
================================================
/* global hexo */
'use strict';
hexo.config.markdown = Object.assign({
preset: 'default',
render: {},
anchors: {}
}, hexo.config.markdown);
hexo.config.markdown.render = Object.assign({
html: true,
xhtmlOut: false,
breaks: true,
linkify: true,
typographer: true,
quotes: '“”‘’'
}, hexo.config.markdown.render);
hexo.config.markdown.anchors = Object.assign({
level: 2,
collisionSuffix: '',
permalink: false,
permalinkClass: 'header-anchor',
permalinkSide: 'left',
permalinkSymbol: '¶',
case: 0,
separator: '-'
}, hexo.config.markdown.anchors);
const Renderer = require('./lib/renderer');
const renderer = new Renderer(hexo);
renderer.disableNunjucks = Boolean(hexo.config.markdown.disableNunjucks);
function render(data, options) {
return renderer.render(data, options);
}
hexo.extend.renderer.register('md', 'html', render, true);
hexo.extend.renderer.register('markdown', 'html', render, true);
hexo.extend.renderer.register('mkd', 'html', render, true);
hexo.extend.renderer.register('mkdn', 'html', render, true);
hexo.extend.renderer.register('mdwn', 'html', render, true);
hexo.extend.renderer.register('mdtxt', 'html', render, true);
hexo.extend.renderer.register('mdtext', 'html', render, true);
================================================
FILE: lib/anchors.js
================================================
'use strict';
const Token = require('markdown-it/lib/token');
const { slugize } = require('hexo-util');
const renderPermalink = function(slug, opts, tokens, idx) {
const permalink = [Object.assign(new Token('link_open', 'a', 1), {
attrs: [['class', opts.permalinkClass], ['href', '#' + slug]]
}), Object.assign(new Token('text', '', 0), {
content: opts.permalinkSymbol
}), new Token('link_close', 'a', -1), Object.assign(new Token('text', '', 0), {
content: ''
})];
if (opts.permalinkSide === 'right') {
return tokens[idx + 1].children.push(...permalink);
}
return tokens[idx + 1].children.unshift(...permalink);
};
const anchor = function(md, opts) {
Object.assign(opts, { renderPermalink });
let titleStore = {};
const originalHeadingOpen = md.renderer.rules.heading_open;
const slugOpts = { transform: opts.case, ...opts };
md.renderer.rules.heading_open = function(...args) {
const [tokens, idx, something, somethingelse, self] = args; // eslint-disable-line no-unused-vars
if (tokens[idx].tag.substr(1) >= opts.level) {
let _tokens$idx;
const title = tokens[idx + 1].children.reduce((acc, t) => {
return acc + t.content;
}, '');
let slug = slugize(title, slugOpts);
if (Object.prototype.hasOwnProperty.call(titleStore, slug)) {
titleStore[slug] = titleStore[slug] + 1;
slug = slug + '-' + opts.collisionSuffix + titleStore[slug].toString();
} else {
titleStore[slug] = 1;
}
(_tokens$idx = tokens[idx], !_tokens$idx.attrs && (_tokens$idx.attrs = []), _tokens$idx.attrs)
.push(['id', slug]);
if (opts.permalink) {
opts.renderPermalink.apply(opts, [slug, opts].concat(args));
}
}
return originalHeadingOpen
? originalHeadingOpen.apply(this, args)
: self.renderToken.apply(self, args);
};
md.core.ruler.push('clear_anchor_title_store', () => {
titleStore = {};
});
};
module.exports = anchor;
================================================
FILE: lib/images.js
================================================
'use strict';
const { join, relative: relativePosix } = require('path').posix;
const { relative, basename, extname, dirname, isAbsolute } = require('path');
const { url_for } = require('hexo-util');
function images(md, opts) {
const { hexo, images } = opts;
const { lazyload, prepend_root: prependRoot, post_asset: postAsset } = images;
const { relative_link, model, base_dir, source_dir } = hexo;
md.renderer.rules.image = function(tokens, idx, options, env, self) {
const token = tokens[idx];
const { postPath } = env;
token.attrSet('alt', token.content);
if (lazyload) {
token.attrSet('loading', 'lazy');
}
if (!prependRoot && !postAsset) {
return self.renderToken(tokens, idx, options);
}
const srcIdx = token.attrs.findIndex(attr => attr[0] === 'src');
let src = token.attrs[srcIdx][1];
if (!/^(#|\/\/|http(s)?:)/.test(src) && !relative_link) {
if (!(src.startsWith('/') || src.startsWith('\\')) && postAsset) {
const PostAsset = model.call(hexo, 'PostAsset');
let assetDirBasePath = join(basename(source_dir), dirname(relativePosix(source_dir, postPath)), basename(postPath, extname(postPath)));
if (isAbsolute(assetDirBasePath)) assetDirBasePath = relative(base_dir, assetDirBasePath);
assetDirBasePath = assetDirBasePath.replace(/\\/g, '/');
const asset = [
join(assetDirBasePath, src),
join(assetDirBasePath, src.replace(new RegExp('^' + basename(postPath, extname(postPath)) + '/'), ''))
]
.map(id => PostAsset.findById(id))
.filter(Boolean);
if (asset.length) {
src = asset[0].path.replace(/\\/g, '/');
}
}
token.attrSet('src', url_for.call(hexo, src));
}
return self.renderToken(tokens, idx, options);
};
}
module.exports = images;
================================================
FILE: lib/renderer.js
================================================
'use strict';
const MarkdownIt = require('markdown-it');
const path = require('path');
class Renderer {
/**
* constructor
*
* @param {*} hexo context of hexo
*/
constructor(hexo) {
this.hexo = hexo;
let { markdown } = hexo.config;
// Temporary backward compatibility
if (typeof markdown === 'string') {
markdown = {
preset: markdown,
};
hexo.log.warn(
`Deprecated config detected. Please use\n\nmarkdown:\n preset: ${markdown.preset}\n\nSee https://github.com/hexojs/hexo-renderer-markdown-it#options`
);
}
const { preset, render, enable_rules, disable_rules, plugins, anchors, images } = markdown;
this.parser = new MarkdownIt(preset, render);
if (enable_rules) {
this.parser.enable(enable_rules);
}
if (disable_rules) {
this.parser.disable(disable_rules);
}
if (plugins) {
this.parser = plugins.reduce((parser, pugs) => {
if (pugs instanceof Object && pugs.name) {
const resolved = require.resolve(pugs.name, {
paths: [
// find from root hexo base directory node_modules
path.join(hexo.base_dir, 'node_modules'),
// find from current installed library node_modules
path.join(__dirname, '../node_modules'),
// find from root hexo base directory
hexo.base_dir,
// find from current library directory
path.join(__dirname, '../'),
],
});
return parser.use(require(resolved), pugs.options);
}
return parser.use(require(pugs));
}, this.parser);
}
if (anchors) {
this.parser.use(require('./anchors'), anchors);
}
if (images) {
this.parser.use(require('./images'), {
images,
hexo: this.hexo,
});
}
}
render(data, options) {
this.hexo.execFilterSync('markdown-it:renderer', this.parser, { context: this });
if (options != null && options.inline === true) {
return this.parser.renderInline(data.text, {
postPath: data.path
});
}
return this.parser.render(data.text, {
postPath: data.path,
});
}
}
module.exports = Renderer;
================================================
FILE: package.json
================================================
{
"name": "hexo-renderer-markdown-it",
"version": "7.1.1",
"description": "Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.",
"main": "index.js",
"scripts": {
"eslint": "eslint .",
"test": "mocha test/index.js",
"test-cov": "c8 --reporter=lcovonly npm run test"
},
"repository": "hexojs/hexo-renderer-markdown-it",
"keywords": [
"hexo",
"renderer",
"markdown",
"markdown-it",
"hexo-renderer"
],
"directories": {
"lib": "./lib"
},
"files": [
"index.js",
"lib/"
],
"author": "Celso Miranda <contacto@celsomiranda.net> (http://celsomiranda.net/)",
"maintainers": [
"Hexo Core Team (https://github.com/orgs/hexojs/teams/core)"
],
"license": "MIT",
"bugs": "https://github.com/hexojs/hexo-renderer-markdown-it/issues",
"homepage": "https://github.com/hexojs/hexo-renderer-markdown-it",
"dependencies": {
"hexo-util": "^3.0.1",
"markdown-it": "^13.0.1",
"markdown-it-abbr": "^1.0.4",
"markdown-it-attrs": "^4.1.3",
"markdown-it-cjk-breaks": "^1.1.2",
"markdown-it-container": "^3.0.0",
"markdown-it-deflist": "^2.0.3",
"markdown-it-emoji": "^2.0.0",
"markdown-it-footnote": "^3.0.1",
"markdown-it-ins": "^3.0.0",
"markdown-it-mark": "^3.0.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0"
},
"devDependencies": {
"chai": "^4.3.7",
"eslint": "^8.41.0",
"eslint-config-hexo": "^5.0.0",
"hexo": "^7.0.0",
"mocha": "^10.2.0",
"c8": "^8.0.1"
},
"engines": {
"node": ">=14"
}
}
================================================
FILE: test/.eslintrc
================================================
{
"extends": "hexo/test"
}
================================================
FILE: test/fixtures/markdownit.md
================================================
# h1 Heading em português
## h2 Heading :P
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rule
___
## Horizontal Rule
---
## Horizontal Rule
***
## Typographic replacements
Enable typographer option to see result.
(c) (C) (r) (R) (tm) (TM) +-
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~~
## Blockquotes
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.
## 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
## Code
Inline `code`
Indented code
// Some comments
line 1 of code
line 2 of code
line 3 of code
Block code "fences"
```
Sample text here...
```
Syntax highlighting
``` js
var foo = function (bar) {
return bar++;
};
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. |
Right aligned columns
| 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. |
## Links
[link text](http://dev.nodeca.com)
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
## Images


![Alt text][id]
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## Plugins
The killer feature of `markdown-it` is very effective support of
[syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).
### [Emojies](https://github.com/markdown-it/markdown-it-emoji)
> Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:
>
> Shortcuts (emoticons): :-) :-( 8-) ;)
see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji.
### [Subscipt](https://github.com/markdown-it/markdown-it-sub) / [Superscirpt](https://github.com/markdown-it/markdown-it-sup)
- 19^th^
- H~2~O
### [\<ins>](https://github.com/markdown-it/markdown-it-ins)
++Inserted text++
### [\<mark>](https://github.com/markdown-it/markdown-it-mark)
==Marked text==
### [Footnotes](https://github.com/markdown-it/markdown-it-footnote)
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
### [Definition lists](https://github.com/markdown-it/markdown-it-deflist)
Term 1
: Definition 1
with lazy continuation.
Term 2 with *inline markup*
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
_Compact style:_
Term 1
~ Definition 1
Term 2
~ Definition 2a
~ Definition 2b
### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr)
This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.
*[HTML]: Hyper Text Markup Language
### [Custom containers](https://github.com/markdown-it/markdown-it-container)
::: warning
*here be dragons*
:::
### [Attributes](https://github.com/arve0/markdown-it-attrs) { data-attr=true }
This is an attribute example.
================================================
FILE: test/fixtures/outputs/anchors.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-P"><a class="header-anchor" href="#h2-Heading-P">¶</a>h2 Heading :P</h2>
<h3 id="h3-Heading"><a class="header-anchor" href="#h3-Heading">¶</a>h3 Heading</h3>
<h4 id="h4-Heading"><a class="header-anchor" href="#h4-Heading">¶</a>h4 Heading</h4>
<h5 id="h5-Heading"><a class="header-anchor" href="#h5-Heading">¶</a>h5 Heading</h5>
<h6 id="h6-Heading"><a class="header-anchor" href="#h6-Heading">¶</a>h6 Heading</h6>
<h2 id="Horizontal-Rule"><a class="header-anchor" href="#Horizontal-Rule">¶</a>Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-ver2"><a class="header-anchor" href="#Horizontal-Rule-ver2">¶</a>Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-ver3"><a class="header-anchor" href="#Horizontal-Rule-ver3">¶</a>Horizontal Rule</h2>
<hr>
<h2 id="Typographic-replacements"><a class="header-anchor" href="#Typographic-replacements">¶</a>Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>© © ® ® ™ ™ ±</p>
<p>test… test… test… test?.. test!..</p>
<p>!!! ??? , – —</p>
<p>“Smartypants, double quotes” and ‘single quotes’</p>
<h2 id="Emphasis"><a class="header-anchor" href="#Emphasis">¶</a>Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p><s>Strikethrough</s></p>
<h2 id="Blockquotes"><a class="header-anchor" href="#Blockquotes">¶</a>Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested…</p>
<blockquote>
<p>…by using additional greater-than signs right next to each other…</p>
<blockquote>
<p>…or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists"><a class="header-anchor" href="#Lists">¶</a>Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code"><a class="header-anchor" href="#Code">¶</a>Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code “fences”</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables"><a class="header-anchor" href="#Tables">¶</a>Tables</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td>engine</td>
<td>engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td>ext</td>
<td>extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<p>Right aligned columns</p>
<table>
<thead>
<tr>
<th style="text-align:right">Option</th>
<th style="text-align:right">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">data</td>
<td style="text-align:right">path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td style="text-align:right">engine</td>
<td style="text-align:right">engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td style="text-align:right">ext</td>
<td style="text-align:right">extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<h2 id="Links"><a class="header-anchor" href="#Links">¶</a>Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link <a href="https://github.com/nodeca/pica">https://github.com/nodeca/pica</a> (enable linkify to see)</p>
<h2 id="Images"><a class="header-anchor" href="#Images">¶</a>Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion"><br>
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat"></p>
<h2 id="Plugins"><a class="header-anchor" href="#Plugins">¶</a>Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br>
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3 id="Emojies"><a class="header-anchor" href="#Emojies">¶</a><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3 id="Subscipt-Superscirpt"><a class="header-anchor" href="#Subscipt-Superscirpt">¶</a><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3 id="ins"><a class="header-anchor" href="#ins">¶</a><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p>++Inserted text++</p>
<h3 id="mark"><a class="header-anchor" href="#mark">¶</a><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p>==Marked text==</p>
<h3 id="Footnotes"><a class="header-anchor" href="#Footnotes">¶</a><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3 id="Definition-lists"><a class="header-anchor" href="#Definition-lists">¶</a><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<p>Term 1</p>
<p>: Definition 1<br>
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1<br>
~ Definition 1</p>
<p>Term 2<br>
~ Definition 2a<br>
~ Definition 2b</p>
<h3 id="Abbreviations"><a class="header-anchor" href="#Abbreviations">¶</a><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is HTML abbreviation example.</p>
<p>It converts “HTML”, but keep intact partial entries like “xxxHTMLyyy” and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3 id="Custom-containers"><a class="header-anchor" href="#Custom-containers">¶</a><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning<br>
<em>here be dragons</em><br>
:::</p>
<h3 id="Attributes-data-attr-true"><a class="header-anchor" href="#Attributes-data-attr-true">¶</a><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/commonmark-deprecated.html
================================================
<h1>h1 Heading em português</h1>
<h2>h2 Heading :P</h2>
<h3>h3 Heading</h3>
<h4>h4 Heading</h4>
<h5>h5 Heading</h5>
<h6>h6 Heading</h6>
<h2>Horizontal Rule</h2>
<hr />
<h2>Horizontal Rule</h2>
<hr />
<h2>Horizontal Rule</h2>
<hr />
<h2>Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>(c) (C) (r) (R) (tm) (TM) +-</p>
<p>test.. test... test..... test?..... test!....</p>
<p>!!!!!! ???? ,, -- ---</p>
<p>"Smartypants, double quotes" and 'single quotes'</p>
<h2>Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p>~~Strikethrough~~</p>
<h2>Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested...</p>
<blockquote>
<p>...by using additional greater-than signs right next to each other...</p>
<blockquote>
<p>...or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2>Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2>Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code "fences"</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2>Tables</h2>
<p>| 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. |</p>
<p>Right aligned columns</p>
<p>| 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. |</p>
<h2>Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link https://github.com/nodeca/pica (enable linkify to see)</p>
<h2>Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion" />
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat" /></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat" /></p>
<h2>Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p>++Inserted text++</p>
<h3><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p>==Marked text==</p>
<h3><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<p>Term 1</p>
<p>: Definition 1
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1
~ Definition 1</p>
<p>Term 2
~ Definition 2a
~ Definition 2b</p>
<h3><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is HTML abbreviation example.</p>
<p>It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning
<em>here be dragons</em>
:::</p>
<h3><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/commonmark.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-P">h2 Heading :P</h2>
<h3 id="h3-Heading">h3 Heading</h3>
<h4 id="h4-Heading">h4 Heading</h4>
<h5 id="h5-Heading">h5 Heading</h5>
<h6 id="h6-Heading">h6 Heading</h6>
<h2 id="Horizontal-Rule">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-2">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-3">Horizontal Rule</h2>
<hr>
<h2 id="Typographic-replacements">Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>(c) (C) (r) (R) (tm) (TM) +-</p>
<p>test.. test... test..... test?..... test!....</p>
<p>!!!!!! ???? ,, -- ---</p>
<p>"Smartypants, double quotes" and 'single quotes'</p>
<h2 id="Emphasis">Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p>~~Strikethrough~~</p>
<h2 id="Blockquotes">Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested...</p>
<blockquote>
<p>...by using additional greater-than signs right next to each other...</p>
<blockquote>
<p>...or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists">Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code">Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code "fences"</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables">Tables</h2>
<p>| Option | Description |<br>
| ------ | ----------- |<br>
| data | path to data files to supply the data that will be passed into templates. |<br>
| engine | engine to be used for processing templates. Handlebars is the default. |<br>
| ext | extension to be used for dest files. |</p>
<p>Right aligned columns</p>
<p>| Option | Description |<br>
| ------:| -----------:|<br>
| data | path to data files to supply the data that will be passed into templates. |<br>
| engine | engine to be used for processing templates. Handlebars is the default. |<br>
| ext | extension to be used for dest files. |</p>
<h2 id="Links">Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link https://github.com/nodeca/pica (enable linkify to see)</p>
<h2 id="Images">Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion"><br>
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat"></p>
<h2 id="Plugins">Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br>
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3 id="Emojies"><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3 id="Subscipt-Superscirpt"><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3 id="ins"><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p>++Inserted text++</p>
<h3 id="mark"><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p>==Marked text==</p>
<h3 id="Footnotes"><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3 id="Definition-lists"><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<p>Term 1</p>
<p>: Definition 1<br>
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1<br>
~ Definition 1</p>
<p>Term 2<br>
~ Definition 2a<br>
~ Definition 2b</p>
<h3 id="Abbreviations"><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is HTML abbreviation example.</p>
<p>It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3 id="Custom-containers"><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning<br>
<em>here be dragons</em><br>
:::</p>
<h3 id="Attributes-data-attr-true"><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/custom.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-P">h2 Heading :P</h2>
<h3 id="h3-Heading">h3 Heading</h3>
<h4 id="h4-Heading">h4 Heading</h4>
<h5 id="h5-Heading">h5 Heading</h5>
<h6 id="h6-Heading">h6 Heading</h6>
<h2 id="Horizontal-Rule">Horizontal Rule</h2>
<hr />
<h2 id="Horizontal-Rule-2">Horizontal Rule</h2>
<hr />
<h2 id="Horizontal-Rule-3">Horizontal Rule</h2>
<hr />
<h2 id="Typographic-replacements">Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>© © ® ® ™ ™ ±</p>
<p>test… test… test… test?.. test!..</p>
<p>!!! ??? , – —</p>
<p>«Smartypants, double quotes» and “single quotes”</p>
<h2 id="Emphasis">Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p><s>Strikethrough</s></p>
<h2 id="Blockquotes">Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested…</p>
<blockquote>
<p>…by using additional greater-than signs right next to each other…</p>
<blockquote>
<p>…or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists">Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code">Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code «fences»</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables">Tables</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td>engine</td>
<td>engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td>ext</td>
<td>extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<p>Right aligned columns</p>
<table>
<thead>
<tr>
<th style="text-align:right">Option</th>
<th style="text-align:right">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">data</td>
<td style="text-align:right">path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td style="text-align:right">engine</td>
<td style="text-align:right">engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td style="text-align:right">ext</td>
<td style="text-align:right">extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<h2 id="Links">Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link <a href="https://github.com/nodeca/pica">https://github.com/nodeca/pica</a> (enable linkify to see)</p>
<h2 id="Images">Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion" /><br />
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat" /></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat" /></p>
<h2 id="Plugins">Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br />
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3 id="Emojies"><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3 id="Subscipt-Superscirpt"><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3 id="ins"><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p>++Inserted text++</p>
<h3 id="mark"><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p>==Marked text==</p>
<h3 id="Footnotes"><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3 id="Definition-lists"><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<p>Term 1</p>
<p>: Definition 1<br />
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1<br />
~ Definition 1</p>
<p>Term 2<br />
~ Definition 2a<br />
~ Definition 2b</p>
<h3 id="Abbreviations"><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is HTML abbreviation example.</p>
<p>It converts «HTML», but keep intact partial entries like «xxxHTMLyyy» and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3 id="Custom-containers"><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning<br />
<em>here be dragons</em><br />
:::</p>
<h3 id="Attributes-data-attr-true"><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/default-disable_rules.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-P">h2 Heading :P</h2>
<h3 id="h3-Heading">h3 Heading</h3>
<h4 id="h4-Heading">h4 Heading</h4>
<h5 id="h5-Heading">h5 Heading</h5>
<h6 id="h6-Heading">h6 Heading</h6>
<h2 id="Horizontal-Rule">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-2">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-3">Horizontal Rule</h2>
<hr>
<h2 id="Typographic-replacements">Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>© © ® ® ™ ™ ±</p>
<p>test… test… test… test?.. test!..</p>
<p>!!! ??? , – —</p>
<p>“Smartypants, double quotes” and ‘single quotes’</p>
<h2 id="Emphasis">Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p><s>Strikethrough</s></p>
<h2 id="Blockquotes">Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested…</p>
<blockquote>
<p>…by using additional greater-than signs right next to each other…</p>
<blockquote>
<p>…or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists">Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code">Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code “fences”</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables">Tables</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td>engine</td>
<td>engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td>ext</td>
<td>extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<p>Right aligned columns</p>
<table>
<thead>
<tr>
<th style="text-align:right">Option</th>
<th style="text-align:right">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">data</td>
<td style="text-align:right">path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td style="text-align:right">engine</td>
<td style="text-align:right">engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td style="text-align:right">ext</td>
<td style="text-align:right">extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<h2 id="Links">Links</h2>
<p>[link text](http://dev.nodeca.com)</p>
<p>Autoconverted link https://github.com/nodeca/pica (enable linkify to see)</p>
<h2 id="Images">Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion"><br>
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat"></p>
<h2 id="Plugins">Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br>
[syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).</p>
<h3 id="Emojies-https-github-com-markdown-it-markdown-it-emoji">[Emojies](https://github.com/markdown-it/markdown-it-emoji)</h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji.</p>
<h3 id="Subscipt-https-github-com-markdown-it-markdown-it-sub-Superscirpt-https-github-com-markdown-it-markdown-it-sup">[Subscipt](https://github.com/markdown-it/markdown-it-sub) / [Superscirpt](https://github.com/markdown-it/markdown-it-sup)</h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3 id="ins-https-github-com-markdown-it-markdown-it-ins">[<ins>](https://github.com/markdown-it/markdown-it-ins)</h3>
<p>++Inserted text++</p>
<h3 id="mark-https-github-com-markdown-it-markdown-it-mark">[<mark>](https://github.com/markdown-it/markdown-it-mark)</h3>
<p>==Marked text==</p>
<h3 id="Footnotes-https-github-com-markdown-it-markdown-it-footnote">[Footnotes](https://github.com/markdown-it/markdown-it-footnote)</h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3 id="Definition-lists-https-github-com-markdown-it-markdown-it-deflist">[Definition lists](https://github.com/markdown-it/markdown-it-deflist)</h3>
<p>Term 1</p>
<p>: Definition 1<br>
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1<br>
~ Definition 1</p>
<p>Term 2<br>
~ Definition 2a<br>
~ Definition 2b</p>
<h3 id="Abbreviations-https-github-com-markdown-it-markdown-it-abbr">[Abbreviations](https://github.com/markdown-it/markdown-it-abbr)</h3>
<p>This is HTML abbreviation example.</p>
<p>It converts “HTML”, but keep intact partial entries like “xxxHTMLyyy” and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3 id="Custom-containers-https-github-com-markdown-it-markdown-it-container">[Custom containers](https://github.com/markdown-it/markdown-it-container)</h3>
<p>::: warning<br>
<em>here be dragons</em><br>
:::</p>
<h3 id="Attributes-https-github-com-arve0-markdown-it-attrs-data-attr-true">[Attributes](https://github.com/arve0/markdown-it-attrs) { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/default.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-P">h2 Heading :P</h2>
<h3 id="h3-Heading">h3 Heading</h3>
<h4 id="h4-Heading">h4 Heading</h4>
<h5 id="h5-Heading">h5 Heading</h5>
<h6 id="h6-Heading">h6 Heading</h6>
<h2 id="Horizontal-Rule">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-2">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-3">Horizontal Rule</h2>
<hr>
<h2 id="Typographic-replacements">Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>© © ® ® ™ ™ ±</p>
<p>test… test… test… test?.. test!..</p>
<p>!!! ??? , – —</p>
<p>“Smartypants, double quotes” and ‘single quotes’</p>
<h2 id="Emphasis">Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p><s>Strikethrough</s></p>
<h2 id="Blockquotes">Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested…</p>
<blockquote>
<p>…by using additional greater-than signs right next to each other…</p>
<blockquote>
<p>…or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists">Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code">Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code “fences”</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables">Tables</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td>engine</td>
<td>engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td>ext</td>
<td>extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<p>Right aligned columns</p>
<table>
<thead>
<tr>
<th style="text-align:right">Option</th>
<th style="text-align:right">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">data</td>
<td style="text-align:right">path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td style="text-align:right">engine</td>
<td style="text-align:right">engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td style="text-align:right">ext</td>
<td style="text-align:right">extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<h2 id="Links">Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link <a href="https://github.com/nodeca/pica">https://github.com/nodeca/pica</a> (enable linkify to see)</p>
<h2 id="Images">Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion"><br>
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat"></p>
<h2 id="Plugins">Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br>
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3 id="Emojies"><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:</p>
<p>Shortcuts (emoticons): :-) :-( 8-) ;)</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3 id="Subscipt-Superscirpt"><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19^th^</li>
<li>H~2~O</li>
</ul>
<h3 id="ins"><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p>++Inserted text++</p>
<h3 id="mark"><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p>==Marked text==</p>
<h3 id="Footnotes"><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote <strong>can have markup</strong></p>
<pre><code>and multiple paragraphs.
</code></pre>
<p>[^second]: Footnote text.</p>
<h3 id="Definition-lists"><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<p>Term 1</p>
<p>: Definition 1<br>
with lazy continuation.</p>
<p>Term 2 with <em>inline markup</em></p>
<p>: Definition 2</p>
<pre><code> { some code, part of Definition 2 }
Third paragraph of definition 2.
</code></pre>
<p><em>Compact style:</em></p>
<p>Term 1<br>
~ Definition 1</p>
<p>Term 2<br>
~ Definition 2a<br>
~ Definition 2b</p>
<h3 id="Abbreviations"><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is HTML abbreviation example.</p>
<p>It converts “HTML”, but keep intact partial entries like “xxxHTMLyyy” and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<h3 id="Custom-containers"><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning<br>
<em>here be dragons</em><br>
:::</p>
<h3 id="Attributes-data-attr-true"><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</h3>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/plugins.html
================================================
<h1>h1 Heading em português</h1>
<h2 id="h2-Heading-😛">h2 Heading 😛</h2>
<h3 id="h3-Heading">h3 Heading</h3>
<h4 id="h4-Heading">h4 Heading</h4>
<h5 id="h5-Heading">h5 Heading</h5>
<h6 id="h6-Heading">h6 Heading</h6>
<h2 id="Horizontal-Rule">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-2">Horizontal Rule</h2>
<hr>
<h2 id="Horizontal-Rule-3">Horizontal Rule</h2>
<hr>
<h2 id="Typographic-replacements">Typographic replacements</h2>
<p>Enable typographer option to see result.</p>
<p>© © ® ® ™ ™ ±</p>
<p>test… test… test… test?.. test!..</p>
<p>!!! ??? , – —</p>
<p>“Smartypants, double quotes” and ‘single quotes’</p>
<h2 id="Emphasis">Emphasis</h2>
<p><strong>This is bold text</strong></p>
<p><strong>This is bold text</strong></p>
<p><em>This is italic text</em></p>
<p><em>This is italic text</em></p>
<p><s>Strikethrough</s></p>
<h2 id="Blockquotes">Blockquotes</h2>
<blockquote>
<p>Blockquotes can also be nested…</p>
<blockquote>
<p>…by using additional greater-than signs right next to each other…</p>
<blockquote>
<p>…or with spaces between arrows.</p>
</blockquote>
</blockquote>
</blockquote>
<h2 id="Lists">Lists</h2>
<p>Unordered</p>
<ul>
<li>Create a list by starting a line with <code>+</code>, <code>-</code>, or <code>*</code></li>
<li>Sub-lists are made by indenting 2 spaces:
<ul>
<li>Marker character change forces new list start:
<ul>
<li>Ac tristique libero volutpat at</li>
</ul>
<ul>
<li>Facilisis in pretium nisl aliquet</li>
</ul>
<ul>
<li>Nulla volutpat aliquam velit</li>
</ul>
</li>
</ul>
</li>
<li>Very easy!</li>
</ul>
<p>Ordered</p>
<ol>
<li>Lorem ipsum dolor sit amet</li>
<li>Consectetur adipiscing elit</li>
<li>Integer molestie lorem at massa</li>
</ol>
<h2 id="Code">Code</h2>
<p>Inline <code>code</code></p>
<p>Indented code</p>
<pre><code>// Some comments
line 1 of code
line 2 of code
line 3 of code
</code></pre>
<p>Block code “fences”</p>
<pre><code>Sample text here...
</code></pre>
<p>Syntax highlighting</p>
<pre><code class="language-js">var foo = function (bar) {
return bar++;
};
console.log(foo(5));
</code></pre>
<h2 id="Tables">Tables</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td>engine</td>
<td>engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td>ext</td>
<td>extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<p>Right aligned columns</p>
<table>
<thead>
<tr>
<th style="text-align:right">Option</th>
<th style="text-align:right">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">data</td>
<td style="text-align:right">path to data files to supply the data that will be passed into templates.</td>
</tr>
<tr>
<td style="text-align:right">engine</td>
<td style="text-align:right">engine to be used for processing templates. Handlebars is the default.</td>
</tr>
<tr>
<td style="text-align:right">ext</td>
<td style="text-align:right">extension to be used for dest files.</td>
</tr>
</tbody>
</table>
<h2 id="Links">Links</h2>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link <a href="https://github.com/nodeca/pica">https://github.com/nodeca/pica</a> (enable linkify to see)</p>
<h2 id="Images">Images</h2>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion"><br>
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p><img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat"></p>
<h2 id="Plugins">Plugins</h2>
<p>The killer feature of <code>markdown-it</code> is very effective support of<br>
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<h3 id="Emojies"><a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></h3>
<blockquote>
<p>Classic markup: 😉 :crush: 😢 :tear: 😆 😋</p>
<p>Shortcuts (emoticons): 😃 😦 😎 😉</p>
</blockquote>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<h3 id="Subscipt-Superscirpt"><a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></h3>
<ul>
<li>19<sup>th</sup></li>
<li>H<sub>2</sub>O</li>
</ul>
<h3 id="ins"><a href="https://github.com/markdown-it/markdown-it-ins"><ins></a></h3>
<p><ins>Inserted text</ins></p>
<h3 id="mark"><a href="https://github.com/markdown-it/markdown-it-mark"><mark></a></h3>
<p><mark>Marked text</mark></p>
<h3 id="Footnotes"><a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></h3>
<p>Footnote 1 link<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.</p>
<p>Footnote 2 link<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.</p>
<p>Inline footnote<sup class="footnote-ref"><a href="#fn3" id="fnref3">[3]</a></sup> definition.</p>
<p>Duplicated footnote reference<sup class="footnote-ref"><a href="#fn2" id="fnref2:1">[2:1]</a></sup>.</p>
<h3 id="Definition-lists"><a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></h3>
<dl>
<dt>Term 1</dt>
<dd>
<p>Definition 1<br>
with lazy continuation.</p>
</dd>
<dt>Term 2 with <em>inline markup</em></dt>
<dd>
<p>Definition 2</p>
<pre><code> { some code, part of Definition 2 }
</code></pre>
<p>Third paragraph of definition 2.</p>
</dd>
</dl>
<p><em>Compact style:</em></p>
<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
<dt>Term 2</dt>
<dd>Definition 2a</dd>
<dd>Definition 2b</dd>
</dl>
<h3 id="Abbreviations"><a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></h3>
<p>This is <abbr title="Hyper Text Markup Language">HTML</abbr> abbreviation example.</p>
<p>It converts “<abbr title="Hyper Text Markup Language">HTML</abbr>”, but keep intact partial entries like “xxxHTMLyyy” and so on.</p>
<h3 id="Custom-containers"><a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></h3>
<p>::: warning<br>
<em>here be dragons</em><br>
:::</p>
<h3 data-attr="true" id="Attributes"><a href="https://github.com/arve0/markdown-it-attrs">Attributes</a></h3>
<p>This is an attribute example.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>Footnote <strong>can have markup</strong></p>
<p>and multiple paragraphs. <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn2" class="footnote-item"><p>Footnote text. <a href="#fnref2" class="footnote-backref">↩︎</a> <a href="#fnref2:1" class="footnote-backref">↩︎</a></p>
</li>
<li id="fn3" class="footnote-item"><p>Text of inline footnote <a href="#fnref3" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>
================================================
FILE: test/fixtures/outputs/zero-enable_rules.html
================================================
<p># h1 Heading em português
## h2 Heading :P
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading</p>
<p>## Horizontal Rule</p>
<p>___</p>
<p>## Horizontal Rule</p>
<p>---</p>
<p>## Horizontal Rule</p>
<p>***</p>
<p>## Typographic replacements</p>
<p>Enable typographer option to see result.</p>
<p>(c) (C) (r) (R) (tm) (TM) +-</p>
<p>test.. test... test..... test?..... test!....</p>
<p>!!!!!! ???? ,, -- ---</p>
<p>"Smartypants, double quotes" and 'single quotes'</p>
<p>## Emphasis</p>
<p>**This is bold text**</p>
<p>__This is bold text__</p>
<p>*This is italic text*</p>
<p>_This is italic text_</p>
<p>~~Strikethrough~~</p>
<p>## Blockquotes</p>
<p>> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.</p>
<p>## Lists</p>
<p>Unordered</p>
<p>+ 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!</p>
<p>Ordered</p>
<p>1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa</p>
<p>## Code</p>
<p>Inline `code`</p>
<p>Indented code</p>
<p>// Some comments
line 1 of code
line 2 of code
line 3 of code</p>
<p>Block code "fences"</p>
<p>```
Sample text here...
```</p>
<p>Syntax highlighting</p>
<p>``` js
var foo = function (bar) {
return bar++;
};</p>
<p>console.log(foo(5));
```</p>
<p>## Tables</p>
<p>| 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. |</p>
<p>Right aligned columns</p>
<p>| 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. |</p>
<p>## Links</p>
<p><a href="http://dev.nodeca.com">link text</a></p>
<p>Autoconverted link https://github.com/nodeca/pica (enable linkify to see)</p>
<p>## Images</p>
<p><img src="https://octodex.github.com/images/minion.png" alt="Minion">
<img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat"></p>
<p>![Alt text][id]</p>
<p>[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"</p>
<p>## Plugins</p>
<p>The killer feature of `markdown-it` is very effective support of
<a href="https://www.npmjs.org/browse/keyword/markdown-it-plugin">syntax plugins</a>.</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-emoji">Emojies</a></p>
<p>> Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:
>
> Shortcuts (emoticons): :-) :-( 8-) ;)</p>
<p>see <a href="https://github.com/markdown-it/markdown-it-emoji#change-output">how to change output</a> with twemoji.</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-sub">Subscipt</a> / <a href="https://github.com/markdown-it/markdown-it-sup">Superscirpt</a></p>
<p>- 19^th^
- H~2~O</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-ins">\<ins></a></p>
<p>++Inserted text++</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-mark">\<mark></a></p>
<p>==Marked text==</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-footnote">Footnotes</a></p>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote **can have markup**</p>
<p>and multiple paragraphs.</p>
<p>[^second]: Footnote text.</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-deflist">Definition lists</a></p>
<p>Term 1</p>
<p>: Definition 1
with lazy continuation.</p>
<p>Term 2 with *inline markup*</p>
<p>: Definition 2</p>
<p>{ some code, part of Definition 2 }</p>
<p>Third paragraph of definition 2.</p>
<p>_Compact style:_</p>
<p>Term 1
~ Definition 1</p>
<p>Term 2
~ Definition 2a
~ Definition 2b</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-abbr">Abbreviations</a></p>
<p>This is HTML abbreviation example.</p>
<p>It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<p>### <a href="https://github.com/markdown-it/markdown-it-container">Custom containers</a></p>
<p>::: warning
*here be dragons*
:::</p>
<p>### <a href="https://github.com/arve0/markdown-it-attrs">Attributes</a> { data-attr=true }</p>
<p>This is an attribute example.</p>
================================================
FILE: test/fixtures/outputs/zero.html
================================================
<p># h1 Heading em português
## h2 Heading :P
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading</p>
<p>## Horizontal Rule</p>
<p>___</p>
<p>## Horizontal Rule</p>
<p>---</p>
<p>## Horizontal Rule</p>
<p>***</p>
<p>## Typographic replacements</p>
<p>Enable typographer option to see result.</p>
<p>(c) (C) (r) (R) (tm) (TM) +-</p>
<p>test.. test... test..... test?..... test!....</p>
<p>!!!!!! ???? ,, -- ---</p>
<p>"Smartypants, double quotes" and 'single quotes'</p>
<p>## Emphasis</p>
<p>**This is bold text**</p>
<p>__This is bold text__</p>
<p>*This is italic text*</p>
<p>_This is italic text_</p>
<p>~~Strikethrough~~</p>
<p>## Blockquotes</p>
<p>> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.</p>
<p>## Lists</p>
<p>Unordered</p>
<p>+ 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!</p>
<p>Ordered</p>
<p>1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa</p>
<p>## Code</p>
<p>Inline `code`</p>
<p>Indented code</p>
<p>// Some comments
line 1 of code
line 2 of code
line 3 of code</p>
<p>Block code "fences"</p>
<p>```
Sample text here...
```</p>
<p>Syntax highlighting</p>
<p>``` js
var foo = function (bar) {
return bar++;
};</p>
<p>console.log(foo(5));
```</p>
<p>## Tables</p>
<p>| 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. |</p>
<p>Right aligned columns</p>
<p>| 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. |</p>
<p>## Links</p>
<p>[link text](http://dev.nodeca.com)</p>
<p>Autoconverted link https://github.com/nodeca/pica (enable linkify to see)</p>
<p>## Images</p>
<p>
</p>
<p>![Alt text][id]</p>
<p>[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"</p>
<p>## Plugins</p>
<p>The killer feature of `markdown-it` is very effective support of
[syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).</p>
<p>### [Emojies](https://github.com/markdown-it/markdown-it-emoji)</p>
<p>> Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:
>
> Shortcuts (emoticons): :-) :-( 8-) ;)</p>
<p>see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji.</p>
<p>### [Subscipt](https://github.com/markdown-it/markdown-it-sub) / [Superscirpt](https://github.com/markdown-it/markdown-it-sup)</p>
<p>- 19^th^
- H~2~O</p>
<p>### [\<ins>](https://github.com/markdown-it/markdown-it-ins)</p>
<p>++Inserted text++</p>
<p>### [\<mark>](https://github.com/markdown-it/markdown-it-mark)</p>
<p>==Marked text==</p>
<p>### [Footnotes](https://github.com/markdown-it/markdown-it-footnote)</p>
<p>Footnote 1 link[^first].</p>
<p>Footnote 2 link[^second].</p>
<p>Inline footnote^[Text of inline footnote] definition.</p>
<p>Duplicated footnote reference[^second].</p>
<p>[^first]: Footnote **can have markup**</p>
<p>and multiple paragraphs.</p>
<p>[^second]: Footnote text.</p>
<p>### [Definition lists](https://github.com/markdown-it/markdown-it-deflist)</p>
<p>Term 1</p>
<p>: Definition 1
with lazy continuation.</p>
<p>Term 2 with *inline markup*</p>
<p>: Definition 2</p>
<p>{ some code, part of Definition 2 }</p>
<p>Third paragraph of definition 2.</p>
<p>_Compact style:_</p>
<p>Term 1
~ Definition 1</p>
<p>Term 2
~ Definition 2a
~ Definition 2b</p>
<p>### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr)</p>
<p>This is HTML abbreviation example.</p>
<p>It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.</p>
<p>*[HTML]: Hyper Text Markup Language</p>
<p>### [Custom containers](https://github.com/markdown-it/markdown-it-container)</p>
<p>::: warning
*here be dragons*
:::</p>
<p>### [Attributes](https://github.com/arve0/markdown-it-attrs) { data-attr=true }</p>
<p>This is an attribute example.</p>
================================================
FILE: test/index.js
================================================
'use strict';
require('chai').should();
const { readFileSync } = require('fs');
const { join } = require('path').posix;
const { sep } = require('path');
const Renderer = require('../lib/renderer');
const source = readFileSync('./test/fixtures/markdownit.md', 'utf8');
const Hexo = require('hexo');
const { url_for } = require('hexo-util');
describe('Hexo Renderer Markdown-it', () => {
const hexo = new Hexo(__dirname, { silent: true });
const defaultCfg = JSON.parse(JSON.stringify(Object.assign(hexo.config, {
markdown: {
preset: 'default',
render: {
html: true,
xhtmlOut: false,
breaks: true,
linkify: true,
typographer: true,
quotes: '“”‘’'
},
anchors: {
level: 2,
collisionSuffix: '',
permalink: false,
permalinkClass: 'header-anchor',
permalinkSide: 'left',
permalinkSymbol: '¶',
case: 0,
separator: ''
}
}
})));
beforeEach(() => {
hexo.config = JSON.parse(JSON.stringify(defaultCfg));
});
describe('preset', () => {
it('default', () => {
hexo.config.markdown.preset = 'default';
const parsed_gfm = readFileSync('./test/fixtures/outputs/default.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_gfm);
});
it('commonmark', () => {
hexo.config.markdown.preset = 'commonmark';
const parsed_commonmark = readFileSync('./test/fixtures/outputs/commonmark.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_commonmark);
});
// Deprecated
it('handle deprecated config', () => {
hexo.config.markdown = 'commonmark';
const parsed_commonmark = readFileSync('./test/fixtures/outputs/commonmark-deprecated.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_commonmark);
});
it('zero', () => {
hexo.config.markdown.preset = 'zero';
const parsed_zero = readFileSync('./test/fixtures/outputs/zero.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_zero);
});
});
describe('render options', () => {
it('custom options', () => {
hexo.config.markdown.render = {
html: false,
xhtmlOut: true,
breaks: true,
langPrefix: '',
linkify: true,
typographer: true,
quotes: '«»“”'
};
const parsed_custom = readFileSync('./test/fixtures/outputs/custom.html', 'utf8');
const source = readFileSync('./test/fixtures/markdownit.md', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_custom);
});
it('langPrefix', () => {
hexo.config.markdown.render = {
langPrefix: 'lang-'
};
const text = '```js\nexample\n```';
const renderer = new Renderer(hexo);
const result = renderer.parser.render(text);
result.should.eql('<pre><code class="lang-js">example\n</code></pre>\n');
});
it('render inline', () => {
const text = 'inline text';
const renderer = new Renderer(hexo);
const resultBlock = renderer.render({ text });
const resultInline = renderer.render({ text }, { inline: true });
resultBlock.should.eql('<p>inline text</p>\n');
resultInline.should.eql('inline text');
});
});
describe('plugins', () => {
it('default', () => {
hexo.config.markdown.plugins = [
'markdown-it-abbr',
'markdown-it-attrs',
'markdown-it-container',
'markdown-it-deflist',
'markdown-it-emoji',
'markdown-it-footnote',
'markdown-it-ins',
'markdown-it-mark',
'markdown-it-sub',
'markdown-it-sup'
];
const parsed_plugins = readFileSync('./test/fixtures/outputs/plugins.html', 'utf8');
const source = readFileSync('./test/fixtures/markdownit.md', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_plugins);
});
it('custom options', () => {
hexo.config.markdown.plugins = [
{
name: 'markdown-it-emoji',
options: {
defs: {
smile: ':lorem:'
}
}
}
];
const text = ':smile:';
const renderer = new Renderer(hexo);
const result = renderer.parser.render(text);
result.should.equal('<p>:lorem:</p>\n');
});
});
describe('anchors', () => {
it('collisionSuffix & permalinkClass', () => {
hexo.config.markdown.anchors = {
level: 2,
collisionSuffix: 'ver',
permalink: true,
permalinkClass: 'header-anchor',
permalinkSymbol: '¶'
};
const expected = readFileSync('./test/fixtures/outputs/anchors.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.eql(expected);
});
it('permalink disabled', () => {
hexo.config.markdown.anchors = {
level: 1,
collisionSuffix: '',
permalink: false,
permalinkClass: 'header-anchor',
permalinkSymbol: '¶'
};
const renderer = new Renderer(hexo);
const result = renderer.parser.render('# This is an H1 title\n# This is an H1 title');
const expected = '<h1 id="This-is-an-H1-title">This is an H1 title</h1>\n<h1 id="This-is-an-H1-title-2">This is an H1 title</h1>\n';
result.should.eql(expected);
});
it('slugize - case & separator', () => {
hexo.config.markdown.anchors = {
level: 2,
case: 1,
separator: '_'
};
const renderer = new Renderer(hexo);
const result = renderer.parser.render('## foo BAR');
result.should.equal('<h2 id="foo_bar">foo BAR</h2>\n');
});
it('multiple posts anchor id', () => {
hexo.config.markdown.anchors = {
level: 2,
collisionSuffix: 'ver',
permalink: true,
permalinkClass: 'header-anchor',
permalinkSymbol: '¶'
};
const expected = readFileSync('./test/fixtures/outputs/anchors.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
const result2 = renderer.parser.render(source);
result.should.eql(expected);
result2.should.eql(expected);
});
describe('permalinkSide', () => {
const text = '## foo';
it('left', () => {
hexo.config.markdown.anchors = {
level: 2,
permalink: true,
permalinkClass: 'anchor',
permalinkSide: 'left',
permalinkSymbol: '#'
};
const renderer = new Renderer(hexo);
const result = renderer.parser.render(text);
result.should.equal('<h2 id="foo"><a class="anchor" href="#foo">#</a>foo</h2>\n');
});
it('right', () => {
hexo.config.markdown.anchors = {
level: 2,
permalink: true,
permalinkClass: 'anchor',
permalinkSide: 'right',
permalinkSymbol: '#'
};
const renderer = new Renderer(hexo);
const result = renderer.parser.render(text);
result.should.equal('<h2 id="foo">foo<a class="anchor" href="#foo">#</a></h2>\n');
});
});
});
describe('rules', () => {
it('enable_rules', () => {
hexo.config.markdown.preset = 'zero';
hexo.config.markdown.enable_rules = ['link', 'image'];
const parsed_zero = readFileSync('./test/fixtures/outputs/zero-enable_rules.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed_zero);
});
it('disable_rules', () => {
hexo.config.markdown.preset = 'default';
hexo.config.markdown.render.linkify = false;
hexo.config.markdown.disable_rules = 'link';
const parsed = readFileSync('./test/fixtures/outputs/default-disable_rules.html', 'utf8');
const renderer = new Renderer(hexo);
const result = renderer.parser.render(source);
result.should.equal(parsed);
});
});
describe('execFilter', () => {
it('default', () => {
const renderer = new Renderer(hexo);
const result = renderer.render({ text: '[foo](javascript:bar)' });
result.should.equal('<p>[foo](javascript:bar)</p>\n');
});
it('enable unsafe link', () => {
const filter = md => {
md.validateLink = function() { return true; };
};
hexo.extend.filter.register('markdown-it:renderer', filter);
const renderer = new Renderer(hexo);
const result = renderer.render({ text: '[foo](javascript:bar)' });
hexo.extend.filter.unregister('markdown-it:renderer', filter);
result.should.equal('<p><a href="javascript:bar">foo</a></p>\n');
});
it('should execute loaded scripts', async () => {
const renderer = new Renderer(hexo);
hexo.env.init = true;
await hexo.init();
const result = renderer.render({ text: '[foo](javascript:bar)' });
result.should.equal('<p><a href="javascript:bar">foo</a></p>\n');
});
it('should be called in render', () => {
const iterates = 3;
const spy = {
called: 0,
call() {
this.called++;
}
};
const filter = md => spy.call(md);
hexo.extend.filter.register('markdown-it:renderer', filter);
const renderer = new Renderer(hexo);
for (let i = 0; i < iterates; i++) {
renderer.render({ text: '' });
}
hexo.extend.filter.unregister('markdown-it:renderer', filter);
spy.called.should.equal(iterates);
});
});
describe('nunjucks', () => {
const hexo = new Hexo(__dirname, { silent: true });
const loremFn = () => { return 'ipsum'; };
const engine = 'md';
before(async () => {
await hexo.init();
hexo.config.markdown = {};
const renderer = new Renderer(hexo);
function render(data, options) {
return renderer.parser.render(data.text);
}
hexo.extend.tag.register('lorem', loremFn);
hexo.extend.renderer.register('md', 'html', render, true);
});
it('default', async () => {
const result = await hexo.post.render(null, { content: '**foo** {% lorem %}', engine });
result.content.should.eql('<p><strong>foo</strong> ipsum</p>\n');
});
it('enable disableNunjucks', async () => {
const renderer = hexo.render.renderer.get('md');
renderer.disableNunjucks = true;
hexo.extend.renderer.register('md', 'html', renderer, true);
const result = await hexo.post.render(null, { content: '**foo** {% lorem %}', engine });
result.content.should.eql('<p><strong>foo</strong> {% lorem %}</p>\n');
});
});
describe('image options', () => {
const body = '';
it('add lazyload attribute', () => {
hexo.config.markdown.images = { lazyload: true };
const renderer = new Renderer(hexo);
const result = renderer.render({ text: body });
result.should.eql('<p><img src="/bar/baz.jpg" alt="" loading="lazy"></p>\n');
});
it('keep lazyload attribute', () => {
hexo.config.markdown.images = { lazyload: true };
const renderer = new Renderer(hexo);
const result = renderer.render({ text: body });
result.should.eql('<p><img src="/bar/baz.jpg" alt="" loading="lazy"></p>\n');
});
it('should prepend root', () => {
hexo.config.markdown.images = { prepend_root: true };
const renderer = new Renderer(hexo);
hexo.config.root = '/blog';
const result = renderer.render({ text: body });
result.should.eql('<p><img src="/blog/bar/baz.jpg" alt=""></p>\n');
});
it('alt text', () => {
hexo.config.markdown.images = { test: true };
const renderer = new Renderer(hexo);
const result = renderer.render({ text: '' });
result.should.eql('<p><img src="/bar/baz.jpg" alt="alt text"></p>\n');
});
describe('post_asset', () => {
const Post = hexo.model('Post');
const PostAsset = hexo.model('PostAsset');
beforeEach(() => {
hexo.config.post_asset_folder = true;
hexo.config.markdown.images = {
prepend_root: true,
post_asset: true
};
});
it('should prepend post path', async () => {
const renderer = new Renderer(hexo);
const asset = 'img/bar.svg';
const slug = asset.replace(/\//g, sep);
const content = ``;
const post = await Post.insert({
source: '_posts/foo.md',
slug: 'foo'
});
const postasset = await PostAsset.insert({
_id: `source/_posts/foo/${asset}`,
slug,
post: post._id
});
const expected = url_for.call(hexo, join(post.path, asset));
const result = renderer.render({ text: content, path: post.full_source });
result.should.eql(`<p><img src="${expected}" alt=""></p>\n`);
// should not be Windows path
expected.includes('\\').should.eql(false);
await PostAsset.removeById(postasset._id);
await Post.removeById(post._id);
});
it('should prepend post path without slug', async () => {
const renderer = new Renderer(hexo);
const asset = 'img/bar.svg';
const slug = asset.replace(/\//g, sep);
const content = ``;
const post = await Post.insert({
source: '_posts/foo.md',
slug: 'foo'
});
const postasset = await PostAsset.insert({
_id: `source/_posts/foo/${asset}`,
slug,
post: post._id
});
const expected = url_for.call(hexo, join(post.path, asset));
const result = renderer.render({ text: content, path: post.full_source });
result.should.eql(`<p><img src="${expected}" alt=""></p>\n`);
// should not be Windows path
expected.includes('\\').should.eql(false);
await PostAsset.removeById(postasset._id);
await Post.removeById(post._id);
});
it('should not modify non-post asset', async () => {
const renderer = new Renderer(hexo);
const asset = 'bar.svg';
const siteasset = '/logo/brand.png';
const site = 'http://lorem.ipsum/dolor/huri.bun';
const content = ``;
const post = await Post.insert({
source: '_posts/foo.md',
slug: 'foo'
});
const postasset = await PostAsset.insert({
_id: `source/_posts/foo/${asset}`,
slug: asset,
post: post._id
});
const result = renderer.render({ text: content, path: post.full_source });
result.should.eql([
`<p><img src="${url_for.call(hexo, join(post.path, asset))}" alt="">`,
`<img src="${siteasset}" alt="">`,
`<img src="${site}" alt=""></p>`
].join('') + '\n');
await PostAsset.removeById(postasset._id);
await Post.removeById(post._id);
});
it('post located in subfolder', async () => {
const renderer = new Renderer(hexo);
const asset = 'img/bar.svg';
const slug = asset.replace(/\//g, sep);
const content = ``;
const post = await Post.insert({
source: '_posts/lorem/foo.md',
slug: 'foo'
});
const postasset = await PostAsset.insert({
_id: `source/_posts/lorem/foo/${asset}`,
slug,
post: post._id
});
const expected = url_for.call(hexo, join(post.path, asset));
const result = renderer.render({ text: content, path: post.full_source });
result.should.eql(`<p><img src="${expected}" alt=""></p>\n`);
await PostAsset.removeById(postasset._id);
await Post.removeById(post._id);
});
});
});
});
================================================
FILE: test/scripts/enable_unsafe_link.js
================================================
'use strict';
// eslint-disable-next-line no-undef
hexo.extend.filter.register('markdown-it:renderer', md => {
md.validateLink = function() { return true; };
});
gitextract_pxi85g_4/
├── .eslintignore
├── .eslintrc
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ └── tester.yml
├── .gitignore
├── .mocharc.yml
├── LICENSE
├── README.md
├── index.js
├── lib/
│ ├── anchors.js
│ ├── images.js
│ └── renderer.js
├── package.json
└── test/
├── .eslintrc
├── fixtures/
│ ├── markdownit.md
│ └── outputs/
│ ├── anchors.html
│ ├── commonmark-deprecated.html
│ ├── commonmark.html
│ ├── custom.html
│ ├── default-disable_rules.html
│ ├── default.html
│ ├── plugins.html
│ ├── zero-enable_rules.html
│ └── zero.html
├── index.js
└── scripts/
└── enable_unsafe_link.js
SYMBOL INDEX (7 symbols across 4 files)
FILE: index.js
function render (line 36) | function render(data, options) {
FILE: lib/images.js
function images (line 7) | function images(md, opts) {
FILE: lib/renderer.js
class Renderer (line 6) | class Renderer {
method constructor (line 12) | constructor(hexo) {
method render (line 71) | render(data, options) {
FILE: test/index.js
method call (line 323) | call() {
function render (line 352) | function render(data, options) {
Condensed preview — 27 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (104K chars).
[
{
"path": ".eslintignore",
"chars": 30,
"preview": "node_modules/\ncoverage/\ntmp/\n\n"
},
{
"path": ".eslintrc",
"chars": 41,
"preview": "{\n \"extends\": \"hexo\",\n \"root\": true\n}\n\n"
},
{
"path": ".gitattributes",
"chars": 238,
"preview": "# Auto detect text files and perform LF normalization\n* text=auto\n\n*.cs text diff=csharp\n*.java text diff=j"
},
{
"path": ".github/dependabot.yml",
"chars": 215,
"preview": "version: 2\nupdates:\n- package-ecosystem: npm\n directory: \"/\"\n schedule:\n interval: monthly\n ignore:\n - dependen"
},
{
"path": ".github/workflows/tester.yml",
"chars": 1596,
"preview": "name: Tester\n\non: [push, pull_request]\n\njobs:\n tester:\n runs-on: ${{ matrix.os }}\n strategy:\n matrix:\n "
},
{
"path": ".gitignore",
"chars": 70,
"preview": ".DS_Store\nnode_modules/\ntmp/\n*.log\n.idea/\ncoverage/\npackage-lock.json\n"
},
{
"path": ".mocharc.yml",
"chars": 12,
"preview": "color: true\n"
},
{
"path": "LICENSE",
"chars": 1057,
"preview": "Copyright (c) 2015 Celso Miranda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this s"
},
{
"path": "README.md",
"chars": 11320,
"preview": "# hexo-renderer-markdown-it\n\n[;\nconst { slugize } = require('hexo-util');\n\nconst renderPe"
},
{
"path": "lib/images.js",
"chars": 1858,
"preview": "'use strict';\n\nconst { join, relative: relativePosix } = require('path').posix;\nconst { relative, basename, extname, dir"
},
{
"path": "lib/renderer.js",
"chars": 2254,
"preview": "'use strict';\n\nconst MarkdownIt = require('markdown-it');\nconst path = require('path');\n\nclass Renderer {\n /**\n * con"
},
{
"path": "package.json",
"chars": 1608,
"preview": "{\n \"name\": \"hexo-renderer-markdown-it\",\n \"version\": \"7.1.1\",\n \"description\": \"Markdown-it is a Markdown parser, done "
},
{
"path": "test/.eslintrc",
"chars": 30,
"preview": "{\n \"extends\": \"hexo/test\"\n}\n\n"
},
{
"path": "test/fixtures/markdownit.md",
"chars": 4183,
"preview": "# h1 Heading em português\n## h2 Heading :P\n### h3 Heading\n#### h4 Heading\n##### h5 Heading\n###### h6 Heading\n\n\n## Horizo"
},
{
"path": "test/fixtures/outputs/anchors.html",
"chars": 7449,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-P\"><a class=\"header-anchor\" href=\"#h2-Heading-P\">¶</a>h2 Heading :P<"
},
{
"path": "test/fixtures/outputs/commonmark-deprecated.html",
"chars": 5288,
"preview": "<h1>h1 Heading em português</h1>\n<h2>h2 Heading :P</h2>\n<h3>h3 Heading</h3>\n<h4>h4 Heading</h4>\n<h5>h5 Heading</h5>\n<h6>"
},
{
"path": "test/fixtures/outputs/commonmark.html",
"chars": 5787,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-P\">h2 Heading :P</h2>\n<h3 id=\"h3-Heading\">h3 Heading</h3>\n<h4 id=\"h4"
},
{
"path": "test/fixtures/outputs/custom.html",
"chars": 6151,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-P\">h2 Heading :P</h2>\n<h3 id=\"h3-Heading\">h3 Heading</h3>\n<h4 id=\"h4"
},
{
"path": "test/fixtures/outputs/default-disable_rules.html",
"chars": 6409,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-P\">h2 Heading :P</h2>\n<h3 id=\"h3-Heading\">h3 Heading</h3>\n<h4 id=\"h4"
},
{
"path": "test/fixtures/outputs/default.html",
"chars": 6132,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-P\">h2 Heading :P</h2>\n<h3 id=\"h3-Heading\">h3 Heading</h3>\n<h4 id=\"h4"
},
{
"path": "test/fixtures/outputs/plugins.html",
"chars": 6862,
"preview": "<h1>h1 Heading em português</h1>\n<h2 id=\"h2-Heading-😛\">h2 Heading 😛</h2>\n<h3 id=\"h3-Heading\">h3 Heading</h3>\n<h4 id=\"h4-"
},
{
"path": "test/fixtures/outputs/zero-enable_rules.html",
"chars": 4909,
"preview": "<p># h1 Heading em português\n## h2 Heading :P\n### h3 Heading\n#### h4 Heading\n##### h5 Heading\n###### h6 Heading</p>\n<p>#"
},
{
"path": "test/fixtures/outputs/zero.html",
"chars": 4742,
"preview": "<p># h1 Heading em português\n## h2 Heading :P\n### h3 Heading\n#### h4 Heading\n##### h5 Heading\n###### h6 Heading</p>\n<p>#"
},
{
"path": "test/index.js",
"chars": 16387,
"preview": "'use strict';\n\nrequire('chai').should();\nconst { readFileSync } = require('fs');\nconst { join } = require('path').posix;"
},
{
"path": "test/scripts/enable_unsafe_link.js",
"chars": 165,
"preview": "'use strict';\n\n// eslint-disable-next-line no-undef\nhexo.extend.filter.register('markdown-it:renderer', md => {\n md.val"
}
]
About this extraction
This page contains the full source code of the hexojs/hexo-renderer-markdown-it GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 27 files (95.7 KB), approximately 28.9k tokens, and a symbol index with 7 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.