Merge branch 'master' into fixes_992
This commit is contained in:
commit
9fcd4503da
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*.{json,js}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md, !test/*.md]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
*.min.js
|
28
.eslintrc.json
Normal file
28
.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"extends": "standard",
|
||||
"plugins": [
|
||||
"standard"
|
||||
],
|
||||
"parserOptions": { "ecmaVersion": 5 },
|
||||
"rules": {
|
||||
"semi": "off",
|
||||
"indent": ["warn", 2, {
|
||||
"VariableDeclarator": { "var": 2 },
|
||||
"SwitchCase": 1,
|
||||
"outerIIFEBody": 0
|
||||
}],
|
||||
"space-before-function-paren": "off",
|
||||
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
|
||||
"no-cond-assign": "off",
|
||||
"no-useless-escape": "off",
|
||||
"no-return-assign": "off",
|
||||
"one-var": "off",
|
||||
"no-control-regex": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"amd": true,
|
||||
"jasmine": true
|
||||
}
|
||||
}
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
test/* linguist-vendored
|
||||
|
31
.github/ISSUE_TEMPLATE.md
vendored
31
.github/ISSUE_TEMPLATE.md
vendored
@ -1,11 +1,42 @@
|
||||
**Marked version:**
|
||||
|
||||
**Markdown flavor:** Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a
|
||||
|
||||
<!-- The NPM version or commit hash having the issue -->
|
||||
|
||||
<!--
|
||||
|
||||
If submitting something other than a defect with Marked itself, please use the following:
|
||||
|
||||
**Proposal type:** new feature | project operations | other
|
||||
|
||||
## What pain point are you perceiving?
|
||||
|
||||
## What solution are you suggesting?
|
||||
|
||||
-->
|
||||
|
||||
## Expectation
|
||||
|
||||
**CommonMark Demo:** [demo](https://spec.commonmark.org/dingus/)
|
||||
<!-- You can replace the link above with a permalink from: https://spec.commonmark.org/dingus/ -->
|
||||
|
||||
<!-- Describe the output you are expecting from marked -->
|
||||
|
||||
## Result
|
||||
|
||||
**Marked Demo:** [demo](https://marked.js.org/demo/)
|
||||
<!-- You can replace the link above with a permalink from: https://marked.js.org/demo/ -->
|
||||
|
||||
<!-- Describe the output you received from marked -->
|
||||
|
||||
## What was attempted
|
||||
|
||||
<!-- Describe what code combination got you there -->
|
||||
|
||||
<!--
|
||||
If error is thrown add the following:
|
||||
|
||||
## Call stack & console log
|
||||
|
||||
-->
|
||||
|
53
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
53
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
<!--
|
||||
|
||||
If release PR, add ?template=release.md to the PR url to use the release PR template.
|
||||
|
||||
If badging PR, add ?template=badges.md to the PR url to use the badges PR template.
|
||||
|
||||
Otherwise, you are stating this PR fixes an issue that has been submitted; or,
|
||||
describes the issue or proposal under consideration and contains the project-related code to implement.
|
||||
|
||||
-->
|
||||
|
||||
**Marked version:**
|
||||
|
||||
<!-- The NPM version or commit hash having the issue -->
|
||||
|
||||
**Markdown flavor:** Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a
|
||||
|
||||
## Description
|
||||
|
||||
- Fixes #### (if fixing a known issue; otherwise, describe issue using the following format)
|
||||
|
||||
<!--
|
||||
|
||||
If no issue exists that you're aware of. The maintainers should be able to figure out if it's a duplicate.
|
||||
|
||||
## Expectation
|
||||
|
||||
Describe the output you are expecting from marked
|
||||
|
||||
## Result
|
||||
|
||||
Describe the output you received from marked
|
||||
|
||||
## What was attempted
|
||||
|
||||
Describe what code combination got you there
|
||||
|
||||
-->
|
||||
|
||||
## Contributor
|
||||
|
||||
- [ ] Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
|
||||
- [ ] no tests required for this PR.
|
||||
- [ ] If submitting new feature, it has been documented in the appropriate places.
|
||||
|
||||
## Committer
|
||||
|
||||
In most cases, this should be a different person than the contributor.
|
||||
|
||||
- [ ] Draft GitHub release notes have been updated.
|
||||
- [ ] CI is green (no forced merge required).
|
||||
- [ ] Merge PR
|
50
.github/PULL_REQUEST_TEMPLATE/badges.md
vendored
Normal file
50
.github/PULL_REQUEST_TEMPLATE/badges.md
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
**@mention the contributor:**
|
||||
|
||||
## Recommendation to:
|
||||
|
||||
- [ ] Change user group
|
||||
- [ ] Add a badge
|
||||
- [ ] Remove a badge
|
||||
|
||||
<!--
|
||||
|
||||
Explain your reasoning behind tagging that person.
|
||||
|
||||
Preferably by citing objective examples, like PRs, Issues, and so on.
|
||||
|
||||
-->
|
||||
|
||||
## As the one mentioned, I would like to:
|
||||
|
||||
- [ ] accept the recommendation; or,
|
||||
- [ ] graciously decline; or,
|
||||
- [ ] dispute the recommendation
|
||||
|
||||
within 30 days, if you have not indicated which option you are taking one of the following will happen:
|
||||
|
||||
1. If adding a badge, we will assume you are graciously declining.
|
||||
2. If removing a badge, we will assume you do not want to dispute the recommendation; therefore, the badge will be removed.
|
||||
|
||||
<!--
|
||||
|
||||
Why would someone not accept a badge? Loads of reasons depending on the circumstances.
|
||||
|
||||
1. If you're a committer and someone puts a badge for you on having decision making authority in an area, do you really a) think you earned it and b) think you can do that *and* all the other stuff you got going as a committer, admin, or publisher (not to even mention your outside life)? Maybe not. And that's okay. Thank them for the recognition, explain you aren't able to take more on at the moment. It's cool to get recognized though.
|
||||
2. Maybe you don't feel you actually earned it yet. I remember being in an interview once. The interviewer asked me to give an example of going above and beyond the call of duty. I said, "That's hard. Because what you consider going above and beyond may be what I consider to be 'just rising to'. If we're in battle and you get wounded and I pull you out of the frey before heading back into it, I don't consider that going above and beyond; I consider that rising to."
|
||||
|
||||
Why would someone remove their own badge? Loads of reasons...
|
||||
|
||||
1. Maybe you got a lot going on right now and want to broadcast to the Marked community that, "Hey, I don't want to say I'm going to do this unless I can really commit to it right now in a way that serves the project well." That's awesome! That takes courage! Because a) saying "no" is hard for most humans ("people pleasers") and b) the alternative, well, for those of us here since about October of 2017 (and prior), we know what the alternative can look like.
|
||||
2. Maybe you just think you've done all you can to help and learned all you can from the experience. Again, very awesome and courageous. It takes courage to know when to walk away on your own accord.
|
||||
|
||||
Why would you want to remove someone's badge? Loads of reasons...
|
||||
|
||||
1. Maybe they have decision making authority on something. You asked for their advice. And, you ended up waiting almost a month before receiving a response.
|
||||
2. Maybe it was relevant at the time (Master of Marked, for example) but you think they've lost their former level of skill (fell out of practice, for example). They could always get it back.
|
||||
3. Maybe to signal to them that, "Hey, you seem to have forgotten about us. Are you still around (or alive)?"
|
||||
|
||||
Anyway, you get the idea. This isn't about good or bad...it's just about giving the community a simple game mechanic by which to publicly say, "Thank you" or "Here's what my status is" in the community or "Hey, I think something's wrong here" in a civil manner.
|
||||
|
||||
-->
|
||||
|
||||
Note: All committers must approve via review before merging, the disapproving committer can simply close the PR.
|
25
.github/PULL_REQUEST_TEMPLATE/release.md
vendored
Normal file
25
.github/PULL_REQUEST_TEMPLATE/release.md
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
## Publisher
|
||||
|
||||
- [ ] `$ npm version` has been run.
|
||||
- [ ] Release notes in [draft GitHub release](https://github.com/markedjs/marked/releases) are up to date
|
||||
- [ ] Release notes include which flavors and versions of Markdown are supported by this release
|
||||
- [ ] Committer checklist is complete.
|
||||
- [ ] Merge PR.
|
||||
- [ ] Publish GitHub release using `master` with correct version number.
|
||||
- [ ] `$ npm publish` has been run.
|
||||
- [ ] Create draft GitHub release to prepare next release.
|
||||
|
||||
Note: If merges to `master` occur after submitting this PR and before running `$ npm pubish` you should be able to
|
||||
|
||||
1. pull from `upstream/master` (`git pull upstream master`) into the branch holding this version,
|
||||
2. run `$ npm run build` to regenerate the `min` file, and
|
||||
3. commit and push the updated changes.
|
||||
|
||||
## Committer
|
||||
|
||||
In most cases, this should be someone different than the publisher.
|
||||
|
||||
- [ ] Version in `package.json` has been updated (see [PUBLISHING.md](https://github.com/markedjs/marked/blob/master/docs/PUBLISHING.md)).
|
||||
- [ ] The `marked.min.js` has been updated; or,
|
||||
- [ ] release does not change library.
|
||||
- [ ] CI is green (no forced merge required).
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
test/compiled_tests
|
||||
|
@ -1,2 +1,3 @@
|
||||
.git*
|
||||
test/
|
||||
docs
|
43
.travis.yml
43
.travis.yml
@ -1,5 +1,40 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: unit tests 👩🏽💻
|
||||
script: npm run test:unit
|
||||
node_js: lts/*
|
||||
|
||||
- stage: spec tests 👩🏽💻
|
||||
script: npm run test:specs
|
||||
node_js: v0.10
|
||||
- node_js: v4
|
||||
- node_js: lts/*
|
||||
- node_js: node
|
||||
|
||||
- stage: security scan 🔐
|
||||
script: npm run test:redos
|
||||
node_js: lts/*
|
||||
|
||||
- stage: lint ✨
|
||||
script: npm run test:lint
|
||||
node_js: lts/*
|
||||
|
||||
- stage: minify 🗜️
|
||||
script: |
|
||||
npm run build
|
||||
if ! git diff --quiet; then
|
||||
git config --global user.email "travis@travis-ci.org"
|
||||
git config --global user.name "Travis-CI"
|
||||
git config credential.helper "store --file=.git/credentials"
|
||||
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
|
||||
git commit -am '🗜️ minify [skip ci]'
|
||||
git push origin HEAD:${TRAVIS_BRANCH}
|
||||
fi
|
||||
node_js: lts/*
|
||||
if: branch = master AND type = push
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
|
22
Gulpfile.js
22
Gulpfile.js
@ -1,22 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
var uglify = require('gulp-uglify');
|
||||
var concat = require('gulp-concat');
|
||||
|
||||
var preserveFirstComment = function() {
|
||||
var set = false;
|
||||
|
||||
return function() {
|
||||
if (set) return false;
|
||||
set = true;
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
gulp.task('uglify', function() {
|
||||
gulp.src('lib/marked.js')
|
||||
.pipe(uglify({preserveComments: preserveFirstComment()}))
|
||||
.pipe(concat('marked.min.js'))
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('default', ['uglify']);
|
19
LICENSE
19
LICENSE
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
|
||||
|
||||
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.
|
43
LICENSE.md
Normal file
43
LICENSE.md
Normal file
@ -0,0 +1,43 @@
|
||||
# License information
|
||||
|
||||
## Contribution License Agreement
|
||||
|
||||
If you contribute code to this project, you are implicitly allowing your code
|
||||
to be distributed under the MIT license. You are also implicitly verifying that
|
||||
all code is your original work. `</legalese>`
|
||||
|
||||
## Marked
|
||||
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
|
||||
|
||||
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.
|
||||
|
||||
## Markdown
|
||||
|
||||
Copyright © 2004, John Gruber
|
||||
http://daringfireball.net/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
426
README.md
426
README.md
@ -1,296 +1,37 @@
|
||||
# marked
|
||||
<a href="https://marked.js.org">
|
||||
<img width="60px" height="60px" src="https://marked.js.org/img/logo-black.svg" align="right" />
|
||||
</a>
|
||||
|
||||
> A full-featured markdown parser and compiler, written in JavaScript. Built
|
||||
> for speed.
|
||||
# Marked
|
||||
|
||||
[][badge]
|
||||
[](https://www.npmjs.com/package/marked)
|
||||
[](https://cdn.jsdelivr.net/npm/marked@0.3.19/marked.min.js)
|
||||
[](https://packagephobia.now.sh/result?p=marked@0.3.19)
|
||||
[](https://www.npmjs.com/package/marked)
|
||||
[](https://travis-ci.org/markedjs/marked)
|
||||
|
||||
## Install
|
||||
- ⚡ built for speed
|
||||
- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
|
||||
- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
|
||||
- 🌐 works in a browser, on a server, or from a command line interface (CLI)
|
||||
|
||||
``` bash
|
||||
npm install marked --save
|
||||
```
|
||||
## Demo
|
||||
|
||||
or if you want to use the `marked` CLI tool (not necessary when using npm run-scripts):
|
||||
Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️
|
||||
|
||||
``` bash
|
||||
npm install -g marked
|
||||
```
|
||||
## Docs
|
||||
|
||||
Our [documentation pages](https://marked.js.org) are also rendered using marked 💯
|
||||
|
||||
## Installation
|
||||
|
||||
**CLI:** `npm install -g marked`
|
||||
|
||||
**In-browser:** `npm install marked --save`
|
||||
|
||||
## Usage
|
||||
|
||||
Minimal usage:
|
||||
|
||||
```js
|
||||
var marked = require('marked');
|
||||
console.log(marked('I am using __markdown__.'));
|
||||
// Outputs: <p>I am using <strong>markdown</strong>.</p>
|
||||
```
|
||||
|
||||
Example setting options with default values:
|
||||
|
||||
```js
|
||||
var marked = require('marked');
|
||||
marked.setOptions({
|
||||
renderer: new marked.Renderer(),
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
pedantic: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false
|
||||
});
|
||||
|
||||
console.log(marked('I am using __markdown__.'));
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked in the browser</title>
|
||||
<script src="lib/marked.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script>
|
||||
document.getElementById('content').innerHTML =
|
||||
marked('# Marked in browser\n\nRendered by **marked**.');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## marked(markdownString [,options] [,callback])
|
||||
|
||||
### markdownString
|
||||
|
||||
Type: `string`
|
||||
|
||||
String of markdown source to be compiled.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
Hash of options. Can also be set using the `marked.setOptions` method as seen
|
||||
above.
|
||||
|
||||
### callback
|
||||
|
||||
Type: `function`
|
||||
|
||||
Function called when the `markdownString` has been fully parsed when using
|
||||
async highlighting. If the `options` argument is omitted, this can be used as
|
||||
the second argument.
|
||||
|
||||
## Options
|
||||
|
||||
### highlight
|
||||
|
||||
Type: `function`
|
||||
|
||||
A function to highlight code blocks. The first example below uses async highlighting with
|
||||
[node-pygmentize-bundled][pygmentize], and the second is a synchronous example using
|
||||
[highlight.js][highlight]:
|
||||
|
||||
```js
|
||||
var marked = require('marked');
|
||||
|
||||
var markdownString = '```js\n console.log("hello"); \n```';
|
||||
|
||||
// Async highlighting with pygmentize-bundled
|
||||
marked.setOptions({
|
||||
highlight: function (code, lang, callback) {
|
||||
require('pygmentize-bundled')({ lang: lang, format: 'html' }, code, function (err, result) {
|
||||
callback(err, result.toString());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Using async version of marked
|
||||
marked(markdownString, function (err, content) {
|
||||
if (err) throw err;
|
||||
console.log(content);
|
||||
});
|
||||
|
||||
// Synchronous highlighting with highlight.js
|
||||
marked.setOptions({
|
||||
highlight: function (code) {
|
||||
return require('highlight.js').highlightAuto(code).value;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(marked(markdownString));
|
||||
```
|
||||
|
||||
#### highlight arguments
|
||||
|
||||
`code`
|
||||
|
||||
Type: `string`
|
||||
|
||||
The section of code to pass to the highlighter.
|
||||
|
||||
`lang`
|
||||
|
||||
Type: `string`
|
||||
|
||||
The programming language specified in the code block.
|
||||
|
||||
`callback`
|
||||
|
||||
Type: `function`
|
||||
|
||||
The callback function to call when using an async highlighter.
|
||||
|
||||
### renderer
|
||||
|
||||
Type: `object`
|
||||
Default: `new Renderer()`
|
||||
|
||||
An object containing functions to render tokens to HTML.
|
||||
|
||||
#### Overriding renderer methods
|
||||
|
||||
The renderer option allows you to render tokens in a custom manner. Here is an
|
||||
example of overriding the default heading token rendering by adding an embedded anchor tag like on GitHub:
|
||||
|
||||
```javascript
|
||||
var marked = require('marked');
|
||||
var renderer = new marked.Renderer();
|
||||
|
||||
renderer.heading = function (text, level) {
|
||||
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
|
||||
return '<h' + level + '><a name="' +
|
||||
escapedText +
|
||||
'" class="anchor" href="#' +
|
||||
escapedText +
|
||||
'"><span class="header-link"></span></a>' +
|
||||
text + '</h' + level + '>';
|
||||
};
|
||||
|
||||
console.log(marked('# heading+', { renderer: renderer }));
|
||||
```
|
||||
This code will output the following HTML:
|
||||
```html
|
||||
<h1>
|
||||
<a name="heading-" class="anchor" href="#heading-">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
heading+
|
||||
</h1>
|
||||
```
|
||||
|
||||
#### Block level renderer methods
|
||||
|
||||
- code(*string* code, *string* language)
|
||||
- blockquote(*string* quote)
|
||||
- html(*string* html)
|
||||
- heading(*string* text, *number* level)
|
||||
- hr()
|
||||
- list(*string* body, *boolean* ordered)
|
||||
- listitem(*string* text)
|
||||
- paragraph(*string* text)
|
||||
- table(*string* header, *string* body)
|
||||
- tablerow(*string* content)
|
||||
- tablecell(*string* content, *object* flags)
|
||||
|
||||
`flags` has the following properties:
|
||||
|
||||
```js
|
||||
{
|
||||
header: true || false,
|
||||
align: 'center' || 'left' || 'right'
|
||||
}
|
||||
```
|
||||
|
||||
#### Inline level renderer methods
|
||||
|
||||
- strong(*string* text)
|
||||
- em(*string* text)
|
||||
- codespan(*string* code)
|
||||
- br()
|
||||
- del(*string* text)
|
||||
- link(*string* href, *string* title, *string* text)
|
||||
- image(*string* href, *string* title, *string* text)
|
||||
- text(*string* text)
|
||||
|
||||
### gfm
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Enable [GitHub flavored markdown][gfm].
|
||||
|
||||
### tables
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Enable GFM [tables][tables].
|
||||
This option requires the `gfm` option to be true.
|
||||
|
||||
### breaks
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Enable GFM [line breaks][breaks].
|
||||
This option requires the `gfm` option to be true.
|
||||
|
||||
### pedantic
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Conform to obscure parts of `markdown.pl` as much as possible. Don't fix any of
|
||||
the original markdown bugs or poor behavior.
|
||||
|
||||
### sanitize
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Sanitize the output. Ignore any HTML that has been input.
|
||||
|
||||
### smartLists
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Use smarter list behavior than the original markdown. May eventually be
|
||||
default with the old behavior moved into `pedantic`.
|
||||
|
||||
### smartypants
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Use "smart" typographic punctuation for things like quotes and dashes.
|
||||
|
||||
## Access to lexer and parser
|
||||
|
||||
You also have direct access to the lexer and parser if you so desire.
|
||||
|
||||
``` js
|
||||
var tokens = marked.lexer(text, options);
|
||||
console.log(marked.parser(tokens));
|
||||
```
|
||||
|
||||
``` js
|
||||
var lexer = new marked.Lexer(options);
|
||||
var tokens = lexer.lex(text);
|
||||
console.log(tokens);
|
||||
console.log(lexer.rules);
|
||||
```
|
||||
|
||||
## CLI
|
||||
**CLI**
|
||||
|
||||
``` bash
|
||||
$ marked -o hello.html
|
||||
@ -300,110 +41,27 @@ $ cat hello.html
|
||||
<p>hello world</p>
|
||||
```
|
||||
|
||||
## Philosophy behind marked
|
||||
**Browser**
|
||||
|
||||
The point of marked was to create a markdown compiler where it was possible to
|
||||
frequently parse huge chunks of markdown without having to worry about
|
||||
caching the compiled output somehow...or blocking for an unnecessarily long time.
|
||||
|
||||
marked is very concise and still implements all markdown features. It is also
|
||||
now fully compatible with the client-side.
|
||||
|
||||
marked more or less passes the official markdown test suite in its
|
||||
entirety. This is important because a surprising number of markdown compilers
|
||||
cannot pass more than a few tests. It was very difficult to get marked as
|
||||
compliant as it is. It could have cut corners in several areas for the sake
|
||||
of performance, but did not in order to be exactly what you expect in terms
|
||||
of a markdown rendering. In fact, this is why marked could be considered at a
|
||||
disadvantage in the benchmarks.
|
||||
|
||||
Along with implementing every markdown feature, marked also implements [GFM
|
||||
features][gfmf].
|
||||
|
||||
## Benchmarks
|
||||
|
||||
node v8.9.4
|
||||
|
||||
``` bash
|
||||
$ npm run bench
|
||||
marked completed in 3408ms.
|
||||
marked (gfm) completed in 3465ms.
|
||||
marked (pedantic) completed in 3032ms.
|
||||
showdown (reuse converter) completed in 21444ms.
|
||||
showdown (new converter) completed in 23058ms.
|
||||
markdown-it completed in 3364ms.
|
||||
markdown.js completed in 12090ms.
|
||||
```html
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked in the browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script>
|
||||
document.getElementById('content').innerHTML =
|
||||
marked('# Marked in the browser\n\nRendered by **marked**.');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Pro level
|
||||
|
||||
You also have direct access to the lexer and parser if you so desire.
|
||||
|
||||
``` js
|
||||
var tokens = marked.lexer(text, options);
|
||||
console.log(marked.parser(tokens));
|
||||
```
|
||||
|
||||
``` js
|
||||
var lexer = new marked.Lexer(options);
|
||||
var tokens = lexer.lex(text);
|
||||
console.log(tokens);
|
||||
console.log(lexer.rules);
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ node
|
||||
> require('marked').lexer('> i am using marked.')
|
||||
[ { type: 'blockquote_start' },
|
||||
{ type: 'paragraph',
|
||||
text: 'i am using marked.' },
|
||||
{ type: 'blockquote_end' },
|
||||
links: {} ]
|
||||
```
|
||||
|
||||
## Running Tests & Contributing
|
||||
|
||||
If you want to submit a pull request, make sure your changes pass the test
|
||||
suite. If you're adding a new feature, be sure to add your own test.
|
||||
|
||||
The marked test suite is set up slightly strangely: `test/new` is for all tests
|
||||
that are not part of the original markdown.pl test suite (this is where your
|
||||
test should go if you make one). `test/original` is only for the original
|
||||
markdown.pl tests.
|
||||
|
||||
In other words, if you have a test to add, add it to `test/new/`. If your test
|
||||
uses a certain feature, for example, maybe it assumes GFM is *not* enabled, you
|
||||
can add [front-matter](https://www.npmjs.com/package/front-matter) to the top of
|
||||
your `.md` file
|
||||
|
||||
``` yml
|
||||
---
|
||||
gfm: false
|
||||
---
|
||||
```
|
||||
|
||||
To run the tests:
|
||||
|
||||
``` bash
|
||||
npm run test
|
||||
```
|
||||
|
||||
### Contribution and License Agreement
|
||||
|
||||
If you contribute code to this project, you are implicitly allowing your code
|
||||
to be distributed under the MIT license. You are also implicitly verifying that
|
||||
all code is your original work. `</legalese>`
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
|
||||
See LICENSE for more info.
|
||||
|
||||
[gfm]: https://help.github.com/articles/github-flavored-markdown
|
||||
[gfmf]: http://github.github.com/github-flavored-markdown/
|
||||
[pygmentize]: https://github.com/rvagg/node-pygmentize-bundled
|
||||
[highlight]: https://github.com/isagalaev/highlight.js
|
||||
[badge]: http://badge.fury.io/js/marked
|
||||
[tables]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables
|
||||
[breaks]: https://help.github.com/articles/github-flavored-markdown#newlines
|
||||
|
38
bin/marked
38
bin/marked
@ -5,9 +5,9 @@
|
||||
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, util = require('util')
|
||||
, marked = require('../');
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
marked = require('../');
|
||||
|
||||
/**
|
||||
* Man Page
|
||||
@ -23,9 +23,9 @@ function help() {
|
||||
stdio: 'inherit'
|
||||
};
|
||||
|
||||
spawn('man', [__dirname + '/../man/marked.1'], options)
|
||||
.on('error', function(err) {
|
||||
fs.readFile(__dirname + '/../man/marked.1.txt', 'utf8', function(err, data) {
|
||||
spawn('man', [path.resolve(__dirname, '/../man/marked.1')], options)
|
||||
.on('error', function() {
|
||||
fs.readFile(path.resolve(__dirname, '/../man/marked.1.txt'), 'utf8', function(err, data) {
|
||||
if (err) throw err;
|
||||
console.log(data);
|
||||
});
|
||||
@ -37,13 +37,14 @@ function help() {
|
||||
*/
|
||||
|
||||
function main(argv, callback) {
|
||||
var files = []
|
||||
, options = {}
|
||||
, input
|
||||
, output
|
||||
, arg
|
||||
, tokens
|
||||
, opt;
|
||||
var files = [],
|
||||
options = {},
|
||||
input,
|
||||
output,
|
||||
string,
|
||||
arg,
|
||||
tokens,
|
||||
opt;
|
||||
|
||||
function getarg() {
|
||||
var arg = argv.shift();
|
||||
@ -86,6 +87,10 @@ function main(argv, callback) {
|
||||
case '--input':
|
||||
input = argv.shift();
|
||||
break;
|
||||
case '-s':
|
||||
case '--string':
|
||||
string = argv.shift();
|
||||
break;
|
||||
case '-t':
|
||||
case '--tokens':
|
||||
tokens = true;
|
||||
@ -118,6 +123,9 @@ function main(argv, callback) {
|
||||
function getData(callback) {
|
||||
if (!input) {
|
||||
if (files.length <= 2) {
|
||||
if (string) {
|
||||
return callback(null, string);
|
||||
}
|
||||
return getStdin(callback);
|
||||
}
|
||||
input = files.pop();
|
||||
@ -146,8 +154,8 @@ function main(argv, callback) {
|
||||
*/
|
||||
|
||||
function getStdin(callback) {
|
||||
var stdin = process.stdin
|
||||
, buff = '';
|
||||
var stdin = process.stdin,
|
||||
buff = '';
|
||||
|
||||
stdin.setEncoding('utf8');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "marked",
|
||||
"homepage": "https://github.com/chjj/marked",
|
||||
"homepage": "https://github.com/markedjs/marked",
|
||||
"authors": [
|
||||
"Christopher Jeffrey <chjjeffrey@gmail.com>"
|
||||
],
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "marked",
|
||||
"version": "0.3.4",
|
||||
"repo": "chjj/marked",
|
||||
"repo": "markedjs/marked",
|
||||
"description": "A markdown parser built for speed",
|
||||
"keywords": ["markdown", "markup", "html"],
|
||||
"scripts": ["lib/marked.js"],
|
||||
|
@ -1,2 +0,0 @@
|
||||
# Todo
|
||||
|
164
docs/AUTHORS.md
Normal file
164
docs/AUTHORS.md
Normal file
@ -0,0 +1,164 @@
|
||||
# Authors
|
||||
|
||||
Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each subsequent group is enveloped by the previous one.
|
||||
|
||||
## Users
|
||||
|
||||
Users are anyone using Marked in some fashion, without them, there's no reason for us to exist.
|
||||
|
||||
|Individual or Organization |Website |Project |Submitted by |
|
||||
|:--------------------------|:-----------------------|:------------------------------------|:---------------------------------------------------|
|
||||
|MarkedJS |https://marked.js.org |https://github.com/markedjs/marked |The marked committers |
|
||||
|
||||
To be listed: All fields are optional. Contact any of the committers or, more timely, submit a pull request with the following (using the first row as an example):
|
||||
|
||||
- **Individual or Organization:** The name you would like associated with the record.
|
||||
- **Website:** A URL to a standalone website for the project.
|
||||
- **Project:** A URL for the repository of the project using marked.
|
||||
- **Submitted by:** The name and optional honorifics for the person adding the listing.
|
||||
|
||||
To be removed: Same as above. Only instead of requesting addition request deletion or delete the row yourself.
|
||||
|
||||
## Contributors
|
||||
|
||||
Contributors are users who submit a [PR](https://github.com/markedjs/marked/pulls), [Issue](https://github.com/markedjs/marked/issues), or collaborate in making Marked a better product and experience for all the users.
|
||||
|
||||
|Name |GitHub handle |Badge of honor |
|
||||
|:-------------------|:----------------|:---------------------------------------------|
|
||||
|Brandon der Blätter |@intcreator |Curious Contributor |
|
||||
|Carlos Valle |@carlosvalle |Maker of the Marked mark from 2018 to present |
|
||||
|Federico Soave |@Feder1co5oave |Regent of the Regex, Master of Marked |
|
||||
|Karen Yavine |@karenyavine |Snyk's Security Saint |
|
||||
|Костя Третяк |@KostyaTretyak |-- |
|
||||
|Tom Theisen |@tomtheisen |Defibrillator |
|
||||
|
||||
To be listed: make a contribution and, if it has significant impact, the committers may be able to add you here.
|
||||
|
||||
To be removed: please let us know or submit a PR.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Committers
|
||||
|
||||
Committers are contributors who also have the responsibility, privilege, some might even say burden of being able to review and merge contributions (just usually not their own).
|
||||
|
||||
A note on "decision making authority". This is related to submitting PRs and the [advice process](http://www.reinventingorganizationswiki.com/Decision_Making). The person marked as having decision making authority over a certain area should be sought for advice in that area before committing to a course of action.
|
||||
|
||||
|Name |GitHub handle |Decision making |Badges of honor (tag for questions) |
|
||||
|:--------------|:---------------|:----------------------------------------|:------------------------------------|
|
||||
|Jamie Davis |@davisjam |Seeker of Security | |
|
||||
|Tony Brix |@UziTech |Titan of the test harness and Dr. DevOps | |
|
||||
|
||||
**Should not exceed 5:** For larger PRs affecting more of the codebase and, most likely, review by more people, we try to keep this pool small and responsive and let those with decision making authority have final say without negative repercussions from the other committers.
|
||||
|
||||
To be listed: Committers are usually selected (or they volunteer, using the same process) from contributors who enter the discussions regarding the future direction of Marked (maybe even doing informal reviews of contributions despite not being able to merge them yourself).
|
||||
|
||||
To be removed: You can remove yourself through the [GitHub UI](https://help.github.com/articles/removing-yourself-from-a-collaborator-s-repository/).
|
||||
|
||||
A note on volunteering:
|
||||
|
||||
1. Please do not volunteer unless you believe you can demonstrate to your peers you can do the work required.
|
||||
2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, wehther you able to really commit to it.
|
||||
3. Don't let the previous frighten you away, it can always be changed later by you or your peers.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Admins
|
||||
|
||||
Admins are committers who also have the responsibility, privilege, and burden of selecting committers and making sure the project itself runs smoothly, which includes community maintenance, governance, dispute resolution, and so on. (Letting the contributors easily enter into, and work within, the project to begin contributing, with as little friction as possible.)
|
||||
|
||||
|Name |GitHub handle |Decision making |Badges of honor (tag for questions) |
|
||||
|:--------------|:---------------|:----------------------------------------|:------------------------------------|
|
||||
|Steven |@styfle |Open source, of course and GitHub Guru |Humaning Helper |
|
||||
|
||||
**Should not exceed 3:** When there are too many people with the ability to reolves disputes, the dispute itself can quickly turn into a dispute amongst the admins themselves; therefore, we want this group to be small enough to commit to action and large enough to not put too much burden on one person. (Should ensure faster resolution and responsiveness.)
|
||||
|
||||
To be listed: Admins are usually selected from the pool of committers (or they volunteer, using the same process) who demonstrate good understanding of the marked culture, operations, and do their best to help new contributors get up to speed on how to contribute effectively to the project.
|
||||
|
||||
To be removed: You can remove yourself through the [GitHub UI](https://help.github.com/articles/removing-yourself-from-a-collaborator-s-repository/).
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Publishers
|
||||
|
||||
Publishers are admins who also have the responsibility, privilege, and burden of publishing the new releases to NPM and performing outreach and external stakeholder communications. Further, when things go pear-shaped, they're the ones taking most of the heat. Finally, when things go well, they're the primary ones praising the contributors who made it possible.
|
||||
|
||||
(In other words, while Admins are focused primarily on the internal workings of the project, Publishers are focused on internal *and* external concerns.)
|
||||
|
||||
|Name |GitHub handle |Decision making |Badges of honor (tag for questions) |
|
||||
|:----------|:--------------|:------------------------|:-------------------------------------|
|
||||
|Josh Bruce |@joshbruce |Release Wrangler |Humaning Helper, Heckler of Hypertext |
|
||||
|
||||
**Should not exceed 2:** Having more people with the authority to publish a release can quickly turn into a consensus seeking nightmare (design by committee). Having only one is preferred (Directly Responsible Individual); however, given the nature of the project and its history, having an immediate fallback, and a potential deep fallback (Original author) is probably a good idea.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Original author
|
||||
|
||||
The original author is the publisher who started it all.
|
||||
|
||||
Christopher Jeffrey @chjj
|
||||
|
||||
<h2 id="badges">Badges</h2>
|
||||
|
||||
Badges? You don't *need* no stinkin' badges.
|
||||
|
||||
Movie references aside. (It was either that or, "Let's play a game", but that would have been creepy…that's why it will most likely come later.)
|
||||
|
||||
Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and…dramatic pause…why not two dramatic pauses for emphasis?… how they can be taken away).
|
||||
|
||||
- [ ] Add the appropriate badge to the desired contributor in the desired column of this page, even if they're not listed here yet.
|
||||
- [ ] Submit a PR (we're big on PRs around here, if you haven't noticed, help us help you).
|
||||
- [ ] Follow the instructions for submitting a badge PR. (There are more details to find within. Come on. Everybody likes surprises, right? No? Actually, we just try to put documentation where it belongs, closer to the code and part of the sequence of events.)
|
||||
|
||||
### Badges at play:
|
||||
|
||||
<dl>
|
||||
<dt>Curious Contributor</dt>
|
||||
<dd>A contributor with less than one year on this page who is actively engaged in submitting PRs, Issues, making recommendations, sharing thoughts…without being too annoying about it (let's be clear, submitting 100 Issues recommending the Marked Committers send everyone candy is trying for the badge, not honestly earning it).</dd>
|
||||
<dt>Dr. DevOps</dt>
|
||||
<dd>
|
||||
<p>Someone who understands and contributes to improving the developer experience and flow of Marked into the world.</p>
|
||||
<blockquote>
|
||||
"The main characteristic of the DevOps movement is to strongly advocate automation and monitoring at all steps of software construction, from integration, testing, releasing to deployment and infrastructure management. DevOps aims at shorter development cycles, increased deployment frequency, more dependable releases, in close alignment with business objectives." ~ <a href="https://www.wikipedia.org/wiki/DevOps">Wikipedia</a>
|
||||
</blockquote>
|
||||
</dd>
|
||||
<dt>Eye for the CLI</dt>
|
||||
<dd>At this point? Pretty much anyone who can update that `man` file to the current Marked version without regression in the CLI tool itself.</dd>
|
||||
<dt>GitHub Guru</dt>
|
||||
<dd>Someone who always seems to be able to tell you easier ways to do things with GitHub.</dd>
|
||||
<dt>Humaning Helper</dt>
|
||||
<dd>Someone who goes out of their way to help contributors feel welcomed and valued. Further, someone who takes the extra steps(s) necessary to help new contributors get up to speed. Finally, they maintain composure even in times of disagreement and dispute resolution.</dd>
|
||||
<dt>Heckler of Hypertext</dt>
|
||||
<dd>Someone who demonstrates an esoteric level of knowledge when it comes to HTML. In other words, someone who says things like, "Did you know most Markdown flavors don't have a way to render a description list (`dl`)? All the more reason Markdown `!==` HTML."</dd>
|
||||
<dt>Markdown Maestro</dt>
|
||||
<dd>You know that person who knows about way too many different flavors of Markdown? The one who maybe seems a little too obsessed with the possibilities of Markdown beyond HTML? Come on. You know who they are. Or, at least you could, if you give them this badge.</dd>
|
||||
<dt>Master of Marked</dt>
|
||||
<dd>Someone who demonstrates they know the ins and outs of the codebase for Marked.</dd>
|
||||
<dt>Open source, of course</dt>
|
||||
<dd>Someone who advocates for and has a proven understanding of how to operate within open source communities.</dd>
|
||||
<dt>Regent of the Regex</dt>
|
||||
<dd><p>Can you demonstrate you understand the following without Google and Stackoverflow?</p>
|
||||
<p><code>/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/</code></p>
|
||||
<p>Because this author can't yet. That's who gets these.</p>
|
||||
</dd>
|
||||
<dt>Seeker of Security</dt>
|
||||
<dd>Someone who has demonstrated a high degree of expertise or authority when it comes to software security.</dd>
|
||||
<dt>Titan of the Test Harness</dt>
|
||||
<dd>Someone who demonstrates high-levels of understanding regarding Marked's test harness.</dd>
|
||||
<dt>Totally Tron</dt>
|
||||
<dd>Someone who demonstrates they are willing and able to "fight for the users", both developers dependent on marked to do their jobs as well as end-users interacting with the output (particularly in the realm of those with the disabilities).</dd>
|
||||
</dl>
|
||||
|
||||
### Special badges that come with the job:
|
||||
|
||||
<dl>
|
||||
<dt>Defibrillator</dt>
|
||||
<dd>A contributor who stepped up to help bring Marked back to life by contriuting solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.</dd>
|
||||
<dt>Maker of the Marked mark</dt>
|
||||
<dd>This badge is given to the person or oganization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.</dd>
|
||||
<dt>Release Wrangler</dt>
|
||||
<dd>This is a badge given to all Publishers.</dd>
|
||||
<dt>Snyk's Security Saint</dt>
|
||||
<dd>This is a badge given to whomever primarily reaches out from Snyk to let us know about security issues.</dd>
|
||||
</dl>
|
1
docs/CNAME
Normal file
1
docs/CNAME
Normal file
@ -0,0 +1 @@
|
||||
marked.js.org
|
74
docs/CODE_OF_CONDUCT.md
Normal file
74
docs/CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,74 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to block temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team by submitting a PR with changes to the [AUTHORS](#/AUTHORS.md) page (or emailing josh@8fold.com). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version [1.4][version].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org/
|
||||
[version]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
95
docs/CONTRIBUTING.md
Normal file
95
docs/CONTRIBUTING.md
Normal file
@ -0,0 +1,95 @@
|
||||
# Contributing to Marked
|
||||
|
||||
- [ ] Fork `markedjs/marked`.
|
||||
- [ ] Clone the library locally using GitHub Desktop or the command line.
|
||||
- [ ] Make sure you are on the `master` branch.
|
||||
- [ ] Be sure to run `npm install` or `npm update`.
|
||||
- [ ] Create a branch.
|
||||
- [ ] Make as small a change as possible.
|
||||
- [ ] Run `npm test`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
|
||||
- [ ] Submit a PR.
|
||||
|
||||
## Design principles
|
||||
|
||||
Marked tends to favor following the SOLID set of software design and development principles; mainly the [single responsibility](https://en.wikipedia.org/wiki/Single_responsibility_principle) and [open/closed principles](https://en.wikipedia.org/wiki/Open/closed_principle):
|
||||
|
||||
- **Single responsibility:** Marked, and the components of Marked, have the single responsibility of converting Markdown strings into HTML.
|
||||
- **Open/closed:** Marked favors giving developers the means to easily extend the library and its components over changing Marked's behavior through configuration options.
|
||||
|
||||
## Priorities
|
||||
|
||||
We think we have our priorities sorted to build quality in.
|
||||
|
||||
The following table lists the ticket type labels we use when there is work to be done on the code either through an Issue or a PR; in priority order.
|
||||
|
||||
|Ticket type label |Description |
|
||||
|:----------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|L0 - security |A security vulnerability within the Marked library is discovered. |
|
||||
|L1 - broken |Valid usage results in incorrect output compared to [supported specifications](#/README.md#specifications) OR causes marked to crash AND there is no known workaround for the issue. |
|
||||
|L2 - annoying |Similar to L1 - broken only there is a known workaround avaialable for the issue. |
|
||||
|RR - refactor and re-engineer |Results in an improvement to developers using Marked (improved readability) or end-users (faster performance) or both. |
|
||||
|NFS - new feature (spec related) |A capability Marked does not currently provide but is in one of the [supported specifications](#/README.md#specifications) |
|
||||
|NFU - new feature (user requested) |A capability Marked does not currently provide but has been requested by users of Marked. |
|
||||
|
||||
## Test early, often, and everything
|
||||
|
||||
We try to write test cases to validate output (writing tests based on the [supported specifications](#/README.md#specifications)) and minimize regression (writing tests for issues fixed). Therefore, if you would like to contribute, some things you should know regarding the test harness.
|
||||
|
||||
|Location |Description |
|
||||
|:-------------|:---------------------------------------------------|
|
||||
|/test/browser |For testing Marked in a client-side implementation. |
|
||||
|/test/new |Tests not related to the original `markdown.pl`. |
|
||||
|/test/original|Tests validating against the original `markdown.pl`.|
|
||||
|
||||
If your test uses features or options, assuming `gfm` is set to `false`, for example, you can add [front-matter](https://www.npmjs.com/package/front-matter) to the top of
|
||||
your `.md` file
|
||||
|
||||
``` yml
|
||||
---
|
||||
gfm: false
|
||||
---
|
||||
```
|
||||
|
||||
## Submitting PRs and Issues
|
||||
|
||||
Marked provides templates for submitting both pull requests and issues. When you begin creating a new PR or issue, you will see instructions on using the template.
|
||||
|
||||
The PR templates include checklists for both the submitter and the reviewer, which, in most cases, will not be the same person.
|
||||
|
||||
## Scripts
|
||||
|
||||
When it comes to NPM commands, we try to use the native scripts provided by the NPM framework.
|
||||
|
||||
To run the tests:
|
||||
|
||||
``` bash
|
||||
npm test
|
||||
```
|
||||
|
||||
To test whether you are using the standard syntax rules for the project:
|
||||
|
||||
```bash
|
||||
npm run test:lint
|
||||
```
|
||||
|
||||
To see time comparisons between Marked and other popular Markdown libraries:
|
||||
|
||||
```bash
|
||||
npm run bench
|
||||
```
|
||||
|
||||
To check for (and fix) standardized syntax (lint):
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
To build your own minified version of Marked:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Publishing
|
||||
|
||||
Creating GitHub releases and publishing to NPM is limited to conributors and owners. If you would like more information, please see our [publishing documentation](#/PUBLISHING.md).
|
24
docs/PUBLISHING.md
Normal file
24
docs/PUBLISHING.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Releasing Marked
|
||||
|
||||
- [ ] See [contributing](#/CONTRIBUTING.md)
|
||||
- [ ] Create release branch from `master` (`release-x.y.z`)
|
||||
- [ ] Submit PR with minimal name: Release x.y.z
|
||||
- [ ] Complete PR checklists
|
||||
|
||||
## Overall strategy
|
||||
|
||||
**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new fetures, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
|
||||
|
||||
## Versioning
|
||||
|
||||
We follow [semantic versioning](https://semver.org) where the following sequence is true `[major].[minor].[patch]`; therefore, consider the following implications of the release you are preparing:
|
||||
|
||||
1. **Major:** There is at least one change not deemed backward compatible.
|
||||
2. **Minor:** There is at least one new feature added to the release.
|
||||
3. **Patch:** No breaking changes, no new features.
|
||||
|
||||
What to expect while Marked is a zero-major (0.x.y):
|
||||
|
||||
1. The major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
|
||||
2. The minor will tend to be more analagous to a `major` release.
|
||||
3. The patch will tend to be more analagous to a `minor` release or a collection of bug fixes (patches).
|
112
docs/README.md
Normal file
112
docs/README.md
Normal file
@ -0,0 +1,112 @@
|
||||
<ul>
|
||||
<li><a href="#marked">About</a></li>
|
||||
<li><a href="#demo">Demo</a></li>
|
||||
<li><a href="#installation">Installation</a></li>
|
||||
<li><a href="#usage">Usage</a></li>
|
||||
<li><a href="#specifications">Supported Markdown specifications</a></li>
|
||||
<li><a href="#security">Security</a></li>
|
||||
<li><a href="#contributing">Contributing</a></li>
|
||||
<li><a href="#authors">Authors</a></li>
|
||||
<li><a href="#license">License</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="marked">Marked</h2>
|
||||
|
||||
Marked is
|
||||
|
||||
1. built for speed.<sup>*</sup>
|
||||
2. a low-level markdown compiler for parsing markdown without caching or blocking for long periods of time.<sup>**</sup>
|
||||
3. light-weight while implementing all markdown features from the supported flavors & specifications.<sup>***</sup>
|
||||
4. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.
|
||||
|
||||
<p><small><sup>*</sup> Still working on metrics for comparative analysis and definition.</small><br>
|
||||
<small><sup>**</sup> As few dependencies as possible.</small><br>
|
||||
<small><sup>***</sup> Strict compliance could result in slower processing when running comparative benchmarking.</small></p>
|
||||
|
||||
|
||||
<h2 id="demo">Demo</h2>
|
||||
|
||||
Checkout the [demo page](./demo/) to see marked in action ⛹️
|
||||
|
||||
These documentation pages are also rendered using marked 💯
|
||||
|
||||
|
||||
<h2 id="installation">Installation</h2>
|
||||
|
||||
**CLI:** `npm install -g marked`
|
||||
|
||||
**In-browser:** `npm install marked --save`
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
**CLI**
|
||||
|
||||
``` bash
|
||||
$ marked -o hello.html
|
||||
hello world
|
||||
^D
|
||||
$ cat hello.html
|
||||
<p>hello world</p>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked -s "*hello world*"
|
||||
<p><em>hello world</em></p>
|
||||
```
|
||||
|
||||
**Browser**
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked in the browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script>
|
||||
document.getElementById('content').innerHTML =
|
||||
marked('# Marked in browser\n\nRendered by **marked**.');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
||||
Marked offers [advanced configurations](#/USING_ADVANCED.md) and [extensibility](#/USING_PRO.md) as well.
|
||||
|
||||
<h2 id="specifications">Supported Markdown specifications</h2>
|
||||
|
||||
We actively support the features of the following [Markdown flavors](https://github.com/commonmark/CommonMark/wiki/Markdown-Flavors).
|
||||
|
||||
|Flavor |Version |
|
||||
|:----------------------------------------------------------|:----------|
|
||||
|The original markdown.pl |-- |
|
||||
|[CommonMark](http://spec.commonmark.org/0.28/) |0.28 |
|
||||
|[GitHub Flavored Markdown](https://github.github.com/gfm/) |0.28 |
|
||||
|
||||
By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.
|
||||
|
||||
<h2 id="security">Security</h2>
|
||||
|
||||
The only completely secure system is the one that doesn't exist in the first place. Having said that, we take the security of Marked very seriously.
|
||||
|
||||
Therefore, please disclose potential security issues by email to the project [committers](#/AUTHORS.md) as well as the [listed owners within NPM](https://docs.npmjs.com/cli/owner). We will provide an initial assessment of security reports within 48 hours and should apply patches within 2 weeks (also, feel free to contribute a fix for the issue).
|
||||
|
||||
<h2 id="contributing">Contributing</h2>
|
||||
|
||||
The marked community enjoys a spirit of collaboration and contribution from all comers. Whether you're just getting started with Markdown, JavaScript, and Marked or you're a veteran with it all figured out, we're here to help each other improve as professionals while helping Marked improve technically. Please see our [contributing documentation](#/CONTRIBUTING.md) for more details.
|
||||
|
||||
For our Contribution License Agreement, see our [license](https://github.com/markedjs/marked/blob/master/LICENSE.md).
|
||||
|
||||
<h2 id="authors">Authors</h2>
|
||||
|
||||
For list of credited authors and contributors, please see our [authors page](#/AUTHORS.md).
|
||||
|
||||
<h2 id="license">License</h2>
|
||||
|
||||
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
||||
|
||||
See [license](https://github.com/markedjs/marked/blob/master/LICENSE.md) for more details.
|
78
docs/USING_ADVANCED.md
Normal file
78
docs/USING_ADVANCED.md
Normal file
@ -0,0 +1,78 @@
|
||||
## The `marked` function
|
||||
|
||||
```js
|
||||
marked(markdownString [,options] [,callback])
|
||||
```
|
||||
|
||||
|Argument |Type |Notes |
|
||||
|:---------------------|:------------|:----------------------------------------------------------------------------------------------------|
|
||||
|markdownString |`string` |String of markdown source to be compiled. |
|
||||
|<a href="#options">options</a>|`object`|Hash of options. Can also use `marked.setOptions`. |
|
||||
|callback |`function` |Called when `markdownString` has been parsed. Can be used as second argument if no `options` present.|
|
||||
|
||||
### Alternative using reference
|
||||
|
||||
```js
|
||||
// Create reference instance
|
||||
var myMarked = require('marked');
|
||||
|
||||
// Set options
|
||||
// `highlight` example uses `highlight.js`
|
||||
myMarked.setOptions({
|
||||
renderer: new myMarked.Renderer(),
|
||||
highlight: function(code) {
|
||||
return require('highlight.js').highlightAuto(code).value;
|
||||
},
|
||||
pedantic: false,
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false,
|
||||
xhtml: false
|
||||
});
|
||||
|
||||
// Compile
|
||||
console.log(myMarked('I am using __markdown__.'));
|
||||
```
|
||||
|
||||
<h2 id="options">Options</h2>
|
||||
|
||||
|Member |Type |Default |Since |Notes |
|
||||
|:-----------|:---------|:--------|:--------|:-------------|
|
||||
|baseUrl |`string` |`null` |??? |A prefix url for any relative link. |
|
||||
|breaks |`boolean` |`false` |??? |If true, use GFM [hard](https://github.github.com/gfm/#hard-line-breaks) and [soft](https://github.github.com/gfm/#soft-line-breaks) line breaks. Requires `gfm` be `true`.|
|
||||
|gfm |`boolean` |`true` |??? |If trie. use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
|
||||
|headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).|
|
||||
|headerPrefix|`string` |`''` |??? |A string to prefix the `id` attribute when emitting headings (h1, h2, h3, etc).|
|
||||
|highlight |`function`|`null` |??? |A function to highlight code blocks, see <a href="#highlight">Asynchronous highlighting</a>.|
|
||||
|langPrefix |`string` |`'lang-'`|??? |A string to prefix the className in a `<code>` block. Useful for syntax highlighting.|
|
||||
|mangle |`boolean` |`true` |??? |??? |
|
||||
|pedantic |`boolean` |`false` |??? |If true, conform to the original `markdown.pl` as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides `gfm`.|
|
||||
|renderer |`object` |`new Renderer()`|???|An object containing functions to render tokens to HTML. See [extensibility](USING_PRO.md) for more details.|
|
||||
|sanitize |`boolean` |`false` |??? |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.|
|
||||
|sanitizer |`function`|`null` |??? |A function to sanitize the HTML passed into `markdownString`.|
|
||||
|silent |`boolean` |`false` |??? |??? |
|
||||
|smartlists |`boolean` |`false` |??? |If true, use smarter list behavior than those found in `markdown.pl`.|
|
||||
|smartypants |`boolean` |`false` |??? |If true, use "smart" typographic punctuation for things like quotes and dashes.|
|
||||
|tables |`boolean` |`true` |??? |If true and `gfm` is true, use [GFM Tables extension](https://github.github.com/gfm/#tables-extension-).|
|
||||
|xhtml |`boolean` |`false` |??? |If true, emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML.|
|
||||
|
||||
<h2 id="highlight">Asynchronous highlighting</h2>
|
||||
|
||||
Unlike `highlight.js` the `pygmentize.js` library uses asynchronous highlighting. This example demonstrates that marked is agnostic when it comes to the highlighter you use.
|
||||
|
||||
```js
|
||||
myMarked.setOptions({
|
||||
highlight: function(code, lang, callback) {
|
||||
require('pygmentize-bundled') ({ lang: lang, format: 'html' }, code, function (err, result) {
|
||||
callback(err, result.toString());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log(myMarked(markdownString));
|
||||
```
|
||||
|
||||
In both examples, `code` is a `string` representing the section of code to pass to the highlighter. In this example, `lang` is a `string` informing the highlighter what programming lnaguage to use for the `code` and `callback` is the `function` the asynchronous highlighter will call once complete.
|
157
docs/USING_PRO.md
Normal file
157
docs/USING_PRO.md
Normal file
@ -0,0 +1,157 @@
|
||||
## Extending Marked
|
||||
|
||||
To champion the single-reponsibility and open/closed prinicples, we have tried to make it relatively painless to extend marked. If you are looking to add custom functionality, this is the place to start.
|
||||
|
||||
<ul>
|
||||
<li><a href="#renderer">The renderer</a></li>
|
||||
<li><a href="#lexer">The lexer</a></li>
|
||||
<li><a href="#parser">The parser</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="renderer">The renderer</h2>
|
||||
|
||||
The renderer is...
|
||||
|
||||
**Example:** Overriding default heading token by adding an embedded anchor tag like on GitHub.
|
||||
|
||||
```js
|
||||
// Create reference instance
|
||||
var myMarked = require('marked');
|
||||
|
||||
// Get reference
|
||||
var renderer = new myMarked.Renderer();
|
||||
|
||||
// Override function
|
||||
renderer.heading = function (text, level) {
|
||||
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
|
||||
return `
|
||||
<h${level}>
|
||||
<a name="${escapedText}" class="anchor" href="#${escapedText}">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
${text}
|
||||
</h${level}>`;
|
||||
};
|
||||
|
||||
// Run marked
|
||||
console.log(myMarked('# heading+', { renderer: renderer }));
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
```html
|
||||
<h1>
|
||||
<a name="heading-" class="anchor" href="#heading-">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
heading+
|
||||
</h1>
|
||||
```
|
||||
|
||||
### Block level renderer methods
|
||||
|
||||
- code(*string* code, *string* language)
|
||||
- blockquote(*string* quote)
|
||||
- html(*string* html)
|
||||
- heading(*string* text, *number* level)
|
||||
- hr()
|
||||
- list(*string* body, *boolean* ordered)
|
||||
- listitem(*string* text)
|
||||
- paragraph(*string* text)
|
||||
- table(*string* header, *string* body)
|
||||
- tablerow(*string* content)
|
||||
- tablecell(*string* content, *object* flags)
|
||||
|
||||
`flags` has the following properties:
|
||||
|
||||
```js
|
||||
{
|
||||
header: true || false,
|
||||
align: 'center' || 'left' || 'right'
|
||||
}
|
||||
```
|
||||
|
||||
### Inline level renderer methods
|
||||
|
||||
- strong(*string* text)
|
||||
- em(*string* text)
|
||||
- codespan(*string* code)
|
||||
- br()
|
||||
- del(*string* text)
|
||||
- link(*string* href, *string* title, *string* text)
|
||||
- image(*string* href, *string* title, *string* text)
|
||||
- text(*string* text)
|
||||
|
||||
<h2 id="lexer">The lexer</h2>
|
||||
|
||||
The lexer is...
|
||||
|
||||
|
||||
<h2 id="parser">The parser</h2>
|
||||
|
||||
The parser is...
|
||||
|
||||
***
|
||||
|
||||
<h2 id="extend">Access to lexer and parser</h2>
|
||||
|
||||
You also have direct access to the lexer and parser if you so desire.
|
||||
|
||||
``` js
|
||||
var tokens = marked.lexer(text, options);
|
||||
console.log(marked.parser(tokens));
|
||||
```
|
||||
|
||||
``` js
|
||||
var lexer = new marked.Lexer(options);
|
||||
var tokens = lexer.lex(text);
|
||||
console.log(tokens);
|
||||
console.log(lexer.rules);
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ node
|
||||
> require('marked').lexer('> i am using marked.')
|
||||
[ { type: 'blockquote_start' },
|
||||
{ type: 'paragraph',
|
||||
text: 'i am using marked.' },
|
||||
{ type: 'blockquote_end' },
|
||||
links: {} ]
|
||||
```
|
||||
|
||||
The Lexers build an array of tokens, which will be passed to their respective
|
||||
Parsers. The Parsers process each token in the token arrays,
|
||||
which are removed from the array of tokens:
|
||||
|
||||
``` js
|
||||
const marked = require('marked');
|
||||
|
||||
const md = `
|
||||
# heading
|
||||
|
||||
[link][1]
|
||||
|
||||
[1]: #heading "heading"
|
||||
`;
|
||||
|
||||
const tokens = marked.lexer(md);
|
||||
console.log(tokens);
|
||||
|
||||
const html = marked.parser(tokens);
|
||||
console.log(html);
|
||||
|
||||
console.log(tokens);
|
||||
```
|
||||
|
||||
``` bash
|
||||
[ { type: 'heading', depth: 1, text: 'heading' },
|
||||
{ type: 'paragraph', text: ' [link][1]' },
|
||||
{ type: 'space' },
|
||||
links: { '1': { href: '#heading', title: 'heading' } } ]
|
||||
|
||||
<h1 id="heading">heading</h1>
|
||||
<p> <a href="#heading" title="heading">link</a></p>
|
||||
|
||||
[ links: { '1': { href: '#heading', title: 'heading' } } ]
|
||||
```
|
55
docs/demo/demo.css
Normal file
55
docs/demo/demo.css
Normal file
@ -0,0 +1,55 @@
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
color: #333;
|
||||
background-color: #fbfbfb;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
header {
|
||||
padding-top: 10px;
|
||||
display: flex;
|
||||
height: 58px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.github-ribbon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.containers {
|
||||
display: flex;
|
||||
height: calc(100vh - 68px);
|
||||
}
|
||||
|
||||
.container {
|
||||
flex-basis: 50%;
|
||||
padding: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pane, #input {
|
||||
margin-top: 5px;
|
||||
padding: 0.6em;
|
||||
border: 1px solid #ccc;
|
||||
overflow: auto;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
}
|
175
docs/demo/demo.js
Normal file
175
docs/demo/demo.js
Normal file
@ -0,0 +1,175 @@
|
||||
/* globals marked, unfetch, ES6Promise */
|
||||
|
||||
if (!window.Promise) {
|
||||
window.Promise = ES6Promise;
|
||||
}
|
||||
if (!window.fetch) {
|
||||
window.fetch = unfetch;
|
||||
}
|
||||
|
||||
var $inputElem = document.querySelector('#input');
|
||||
var $outputTypeElem = document.querySelector('#outputType');
|
||||
var $previewElem = document.querySelector('#preview');
|
||||
var $permalinkElem = document.querySelector('#permalink');
|
||||
var $clearElem = document.querySelector('#clear');
|
||||
var $htmlElem = document.querySelector('#html');
|
||||
var $lexerElem = document.querySelector('#lexer');
|
||||
var $panes = document.querySelectorAll('.pane');
|
||||
var inputDirty = true;
|
||||
var $activeElem = null;
|
||||
var changeTimeout = null;
|
||||
var search = searchToObject();
|
||||
|
||||
if ('text' in search) {
|
||||
$inputElem.value = search.text;
|
||||
} else {
|
||||
fetch('./initial.md')
|
||||
.then(function (res) { return res.text(); })
|
||||
.then(function (text) {
|
||||
if ($inputElem.value === '') {
|
||||
$inputElem.value = text;
|
||||
inputDirty = true;
|
||||
clearTimeout(changeTimeout);
|
||||
checkForChanges();
|
||||
setScrollPercent(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (search.outputType) {
|
||||
$outputTypeElem.value = search.outputType;
|
||||
}
|
||||
|
||||
fetch('./quickref.md')
|
||||
.then(function (res) { return res.text(); })
|
||||
.then(function (text) {
|
||||
document.querySelector('#quickref').value = text;
|
||||
});
|
||||
|
||||
function handleChange() {
|
||||
for (var i = 0; i < $panes.length; i++) {
|
||||
$panes[i].style.display = 'none';
|
||||
}
|
||||
$activeElem = document.querySelector('#' + $outputTypeElem.value);
|
||||
$activeElem.style.display = 'block';
|
||||
|
||||
updateLink();
|
||||
};
|
||||
|
||||
$outputTypeElem.addEventListener('change', handleChange, false);
|
||||
handleChange();
|
||||
|
||||
function handleInput() {
|
||||
inputDirty = true;
|
||||
};
|
||||
|
||||
$inputElem.addEventListener('change', handleInput, false);
|
||||
$inputElem.addEventListener('keyup', handleInput, false);
|
||||
$inputElem.addEventListener('keypress', handleInput, false);
|
||||
$inputElem.addEventListener('keydown', handleInput, false);
|
||||
|
||||
$clearElem.addEventListener('click', function () {
|
||||
$inputElem.value = '';
|
||||
handleInput();
|
||||
}, false);
|
||||
|
||||
function searchToObject() {
|
||||
// modified from https://stackoverflow.com/a/7090123/806777
|
||||
var pairs = location.search.slice(1).split('&');
|
||||
var obj = {};
|
||||
|
||||
for (var i = 0; i < pairs.length; i++) {
|
||||
if (pairs[i] === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var pair = pairs[i].split('=');
|
||||
|
||||
obj[decodeURIComponent(pair.shift())] = decodeURIComponent(pair.join('='));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function jsonString(input) {
|
||||
var output = (input + '')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\t/g, '\\t')
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/[\\"']/g, '\\$&')
|
||||
.replace(/\u0000/g, '\\0');
|
||||
return '"' + output + '"';
|
||||
};
|
||||
|
||||
function getScrollSize() {
|
||||
var e = $activeElem;
|
||||
|
||||
return e.scrollHeight - e.clientHeight;
|
||||
};
|
||||
function getScrollPercent() {
|
||||
var size = getScrollSize();
|
||||
|
||||
if (size <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $activeElem.scrollTop / size;
|
||||
};
|
||||
function setScrollPercent(percent) {
|
||||
$activeElem.scrollTop = percent * getScrollSize();
|
||||
};
|
||||
|
||||
function updateLink() {
|
||||
var outputType = '';
|
||||
if ($outputTypeElem.value !== 'preview') {
|
||||
outputType = 'outputType=' + $outputTypeElem.value + '&';
|
||||
}
|
||||
|
||||
$permalinkElem.href = '?' + outputType + 'text=' + encodeURIComponent($inputElem.value);
|
||||
history.replaceState('', document.title, $permalinkElem.href);
|
||||
}
|
||||
|
||||
var delayTime = 1;
|
||||
function checkForChanges() {
|
||||
if (inputDirty) {
|
||||
inputDirty = false;
|
||||
|
||||
updateLink();
|
||||
|
||||
var startTime = new Date();
|
||||
|
||||
var scrollPercent = getScrollPercent();
|
||||
|
||||
var lexed = marked.lexer($inputElem.value);
|
||||
|
||||
var lexedList = [];
|
||||
|
||||
for (var i = 0; i < lexed.length; i++) {
|
||||
var lexedLine = [];
|
||||
for (var j in lexed[i]) {
|
||||
lexedLine.push(j + ':' + jsonString(lexed[i][j]));
|
||||
}
|
||||
lexedList.push('{' + lexedLine.join(', ') + '}');
|
||||
}
|
||||
|
||||
var parsed = marked.parser(lexed);
|
||||
|
||||
$previewElem.innerHTML = (parsed);
|
||||
$htmlElem.value = (parsed);
|
||||
$lexerElem.value = (lexedList.join('\n'));
|
||||
|
||||
setScrollPercent(scrollPercent);
|
||||
|
||||
var endTime = new Date();
|
||||
delayTime = endTime - startTime;
|
||||
if (delayTime < 50) {
|
||||
delayTime = 50;
|
||||
} else if (delayTime > 500) {
|
||||
delayTime = 1000;
|
||||
}
|
||||
}
|
||||
changeTimeout = window.setTimeout(checkForChanges, delayTime);
|
||||
};
|
||||
checkForChanges();
|
||||
setScrollPercent(0);
|
60
docs/demo/index.html
Normal file
60
docs/demo/index.html
Normal file
@ -0,0 +1,60 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Marked Demo</title>
|
||||
<link rel="stylesheet" href="./demo.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="https://github.com/markedjs/marked">
|
||||
<img class="github-ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
|
||||
</a>
|
||||
|
||||
<header>
|
||||
<a href="../">
|
||||
<img src="../img/logo-black.svg" height="64px" width="64px" />
|
||||
</a>
|
||||
<h1>Marked Demo</h1>
|
||||
</header>
|
||||
|
||||
<div class="containers">
|
||||
<div class="container">
|
||||
<div class="label">
|
||||
<span>Input</span> ·
|
||||
<a id="permalink">Permalink</a> ·
|
||||
<button id="clear">Clear</button>
|
||||
</div>
|
||||
<textarea id="input"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="label">
|
||||
<select id="outputType">
|
||||
<option value="preview">Preview</option>
|
||||
<option value="html">HTML Source</option>
|
||||
<option value="lexer">Lexer Data</option>
|
||||
<option value="quickref">Quick Reference</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="preview" class="pane">
|
||||
<noscript>
|
||||
<h2>You'll need to enable Javascript to use this tool.</h2>
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
<textarea id="html" class="pane" readonly="readonly"></textarea>
|
||||
|
||||
<textarea id="lexer" class="pane" readonly="readonly"></textarea>
|
||||
|
||||
<textarea id="quickref" class="pane" readonly="readonly"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/unfetch/dist/unfetch.umd.js"></script>
|
||||
<script src="./demo.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
36
docs/demo/initial.md
Normal file
36
docs/demo/initial.md
Normal file
@ -0,0 +1,36 @@
|
||||
Marked - Markdown Parser
|
||||
========================
|
||||
|
||||
[Marked] lets you convert [Markdown] into HTML. Markdown is a simple text format whose goal is to be very easy to read and write, even when not converted to HTML. This demo page will let you type anything you like and see how it gets converted. Live. No more waiting around.
|
||||
|
||||
How To Use The Demo
|
||||
-------------------
|
||||
|
||||
1. Type in stuff on the left.
|
||||
2. See the live updates on the right.
|
||||
|
||||
That's it. Pretty simple. There's also a drop-down option in the upper right to switch between various views:
|
||||
|
||||
- **Preview:** A live display of the generated HTML as it would render in a browser.
|
||||
- **HTML Source:** The generated HTML before your browser makes it pretty.
|
||||
- **Lexer Data:** What [marked] uses internally, in case you like gory stuff like this.
|
||||
- **Quick Reference:** A brief run-down of how to format things using markdown.
|
||||
|
||||
Why Markdown?
|
||||
-------------
|
||||
|
||||
It's easy. It's not overly bloated, unlike HTML. Also, as the creator of [markdown] says,
|
||||
|
||||
> The overriding design goal for Markdown's
|
||||
> formatting syntax is to make it as readable
|
||||
> as possible. The idea is that a
|
||||
> Markdown-formatted document should be
|
||||
> publishable as-is, as plain text, without
|
||||
> looking like it's been marked up with tags
|
||||
> or formatting instructions.
|
||||
|
||||
Ready to start writing? Either start changing stuff on the left or
|
||||
[clear everything](?text=) with a simple click.
|
||||
|
||||
[Marked]: https://github.com/markedjs/marked/
|
||||
[Markdown]: http://daringfireball.net/projects/markdown/
|
167
docs/demo/quickref.md
Normal file
167
docs/demo/quickref.md
Normal file
@ -0,0 +1,167 @@
|
||||
Markdown Quick Reference
|
||||
========================
|
||||
|
||||
This guide is a very brief overview, with examples, of the syntax that [Markdown] supports. It is itself written in Markdown and you can copy the samples over to the left-hand pane for experimentation. It's shown as *text* and not *rendered HTML*.
|
||||
|
||||
[Markdown]: http://daringfireball.net/projects/markdown/
|
||||
|
||||
|
||||
Simple Text Formatting
|
||||
======================
|
||||
|
||||
First thing is first. You can use *stars* or _underscores_ for italics. **Double stars** and __double underscores__ do bold. ***Three together*** do ___both___.
|
||||
|
||||
Paragraphs are pretty easy too. Just have a blank line between chunks of text.
|
||||
|
||||
> This chunk of text is in a block quote. Its multiple lines will all be
|
||||
> indended a bit from the rest of the text.
|
||||
>
|
||||
> > Multiple levels of block quotes also work.
|
||||
|
||||
Sometimes you want to include some code, such as when you are explaining how `<h1>` HTML tags work, or maybe you are a programmer and you are discussing `someMethod()`.
|
||||
|
||||
If you want to include some code and have
|
||||
newlines preserved, indent the line with a tab
|
||||
or at least four spaces.
|
||||
Extra spaces work here too.
|
||||
This is also called preformatted text and it is useful for showing examples.
|
||||
The text will stay as text, so any *markdown* or <u>HTML</u> you add will
|
||||
not show up formatted. This way you can show markdown examples in a
|
||||
markdown document.
|
||||
|
||||
> You can also use preformatted text with your blockquotes
|
||||
> as long as you add at least five spaces.
|
||||
|
||||
|
||||
Headings
|
||||
========
|
||||
|
||||
There are a couple of ways to make headings. Using three or more equals signs on a line under a heading makes it into an "h1" style. Three or more hyphens under a line makes it "h2" (slightly smaller). You can also use multiple pound symbols before and after a heading. Pounds after the title are ignored. Here's some examples:
|
||||
|
||||
This is H1
|
||||
==========
|
||||
|
||||
This is H2
|
||||
----------
|
||||
|
||||
# This is H1
|
||||
## This is H2
|
||||
### This is H3 with some extra pounds ###
|
||||
#### You get the idea ####
|
||||
##### I don't need extra pounds at the end
|
||||
###### H6 is the max
|
||||
|
||||
|
||||
Links
|
||||
=====
|
||||
|
||||
Let's link to a few sites. First, let's use the bare URL, like <http://www.github.com>. Great for text, but ugly for HTML.
|
||||
Next is an inline link to [Google](http://www.google.com). A little nicer.
|
||||
This is a reference-style link to [Wikipedia] [1].
|
||||
Lastly, here's a pretty link to [Yahoo]. The reference-style and pretty links both automatically use the links defined below, but they could be defined *anywhere* in the markdown and are removed from the HTML. The names are also case insensitive, so you can use [YaHoO] and have it link properly.
|
||||
|
||||
[1]: http://www.wikipedia.org/
|
||||
[Yahoo]: http://www.yahoo.com/
|
||||
|
||||
Title attributes may be added to links by adding text after a link.
|
||||
This is the [inline link](http://www.bing.com "Bing") with a "Bing" title.
|
||||
You can also go to [W3C] [2] and maybe visit a [friend].
|
||||
|
||||
[2]: http://w3c.org (The W3C puts out specs for web-based things)
|
||||
[Friend]: http://facebook.com/ "Facebook!"
|
||||
|
||||
Email addresses in plain text are not linked: test@example.com.
|
||||
Email addresses wrapped in angle brackets are linked: <test@example.com>.
|
||||
They are also obfuscated so that email harvesting spam robots hopefully won't get them.
|
||||
|
||||
|
||||
Lists
|
||||
=====
|
||||
|
||||
* This is a bulleted list
|
||||
* Great for shopping lists
|
||||
- You can also use hyphens
|
||||
+ Or plus symbols
|
||||
|
||||
The above is an "unordered" list. Now, on for a bit of order.
|
||||
|
||||
1. Numbered lists are also easy
|
||||
2. Just start with a number
|
||||
3738762. However, the actual number doesn't matter when converted to HTML.
|
||||
1. This will still show up as 4.
|
||||
|
||||
You might want a few advanced lists:
|
||||
|
||||
- This top-level list is wrapped in paragraph tags
|
||||
- This generates an extra space between each top-level item.
|
||||
|
||||
- You do it by adding a blank line
|
||||
|
||||
- This nested list also has blank lines between the list items.
|
||||
|
||||
- How to create nested lists
|
||||
1. Start your regular list
|
||||
2. Indent nested lists with four spaces
|
||||
3. Further nesting means you should indent with four more spaces
|
||||
* This line is indented with eight spaces.
|
||||
|
||||
- List items can be quite lengthy. You can keep typing and either continue
|
||||
them on the next line with no indentation.
|
||||
|
||||
- Alternately, if that looks ugly, you can also
|
||||
indent the next line a bit for a prettier look.
|
||||
|
||||
- You can put large blocks of text in your list by just indenting with four spaces.
|
||||
|
||||
This is formatted the same as code, but you can inspect the HTML
|
||||
and find that it's just wrapped in a `<p>` tag and *won't* be shown
|
||||
as preformatted text.
|
||||
|
||||
You can keep adding more and more paragraphs to a single
|
||||
list item by adding the traditional blank line and then keep
|
||||
on indenting the paragraphs with four spaces. You really need
|
||||
to only indent the first line, but that looks ugly.
|
||||
|
||||
- Lists support blockquotes
|
||||
|
||||
> Just like this example here. By the way, you can
|
||||
> nest lists inside blockquotes!
|
||||
> - Fantastic!
|
||||
|
||||
- Lists support preformatted text
|
||||
|
||||
You just need to indent eight spaces.
|
||||
|
||||
|
||||
Even More
|
||||
=========
|
||||
|
||||
Horizontal Rule
|
||||
---------------
|
||||
|
||||
If you need a horizontal rule you just need to put at least three hyphens, asterisks, or underscores on a line by themselves. You can also even put spaces between the characters.
|
||||
|
||||
---
|
||||
****************************
|
||||
_ _ _ _ _ _ _
|
||||
|
||||
Those three all produced horizontal lines. Keep in mind that three hyphens under any text turns that text into a heading, so add a blank like if you use hyphens.
|
||||
|
||||
Images
|
||||
------
|
||||
|
||||
Images work exactly like links, but they have exclamation points in front. They work with references and titles too.
|
||||
|
||||
 and ![Happy].
|
||||
|
||||
[Happy]: http://www.wpclipart.com/smiley/simple_smiley/smiley_face_simple_green_small.png ("Smiley face")
|
||||
|
||||
|
||||
Inline HTML
|
||||
-----------
|
||||
|
||||
If markdown is too limiting, you can just insert your own <strike>crazy</strike> HTML. Span-level HTML <u>can *still* use markdown</u>. Block level elements must be separated from text by a blank line and must not have any spaces before the opening and closing HTML.
|
||||
|
||||
<div style='font-family: "Comic Sans", sans-serif;'>
|
||||
It is a pity, but markdown does **not** work in here for most markdown parsers. [Marked] handles it pretty well.
|
||||
</div>
|
133
docs/img/logo-black-and-white.svg
Normal file
133
docs/img/logo-black-and-white.svg
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="996px" height="439.589px" viewBox="0 0 996 439.589" enable-background="new 0 0 996 439.589" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Marked_Letters">
|
||||
<path fill="#010101" d="M185.044,358.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225
|
||||
l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L185.044,358.869z"/>
|
||||
<path fill="#010101" d="M226.617,358.869h-10.811l-1.084-8.994H202.33l-4.102,8.994h-10.605l20.566-40.605h10.986L226.617,358.869
|
||||
z M214.019,344.162l-1.934-15.527l-7.061,15.527H214.019z"/>
|
||||
<path fill="#010101" d="M267.712,358.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373
|
||||
c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.733,3.809
|
||||
c2.061,2.539,3.091,5.283,3.091,8.232c0,3.105-0.854,5.522-2.563,7.251c-1.709,1.729-4.097,2.798-7.163,3.208
|
||||
c1.562,0.898,2.769,1.953,3.618,3.164s1.86,3.096,3.032,5.654L267.712,358.869z M255.525,330.012c0-1.562-0.571-2.925-1.714-4.087
|
||||
s-3.453-1.743-6.929-1.743h-1.611l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S255.525,331.496,255.525,330.012z"/>
|
||||
<path fill="#010101" d="M313.705,318.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.282,21.65h-10.342l6.064-40.605
|
||||
h10.401l-2.578,17.256l16.611-17.256H313.705z"/>
|
||||
<path fill="#010101" d="M346.426,318.264L345.4,325.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98
|
||||
l-1.025,7.266h-30.439l5.889-40.605H346.426z"/>
|
||||
<path fill="#010101" d="M389.953,338.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973
|
||||
s-7.583,2.373-12.582,2.373H348.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365
|
||||
s2.953,3.97,3.764,6.343S389.953,335.461,389.953,338.156z M379.377,338.303c0-2.031-0.387-4.004-1.158-5.918
|
||||
s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172
|
||||
s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C379.152,341.555,379.377,339.963,379.377,338.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M406.922,307.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211
|
||||
l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H406.922z
|
||||
"/>
|
||||
<path fill="#010101" d="M423.027,307.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02
|
||||
s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841
|
||||
s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604
|
||||
c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312
|
||||
c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874
|
||||
c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926
|
||||
C420.016,306.833,421.516,307.155,423.027,307.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#010101" d="M357,200v-92c0-8.284-6.716-15-15-15H172c-8.284,0-15,6.716-15,15v92H357z"/>
|
||||
<path fill="#010101" d="M157,205v73c0,8.284,6.716,15,15,15h170c8.284,0,15-6.716,15-15v-73H157z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M208.737,180.15v-33.125l16.987,21.234l16.987-21.234v33.125h16.987v-57.756h-16.987l-16.987,21.234
|
||||
l-16.987-21.234H191.75v57.756H208.737z"/>
|
||||
<path fill="#FFFFFF" d="M322.55,151.272h-16.987v-28.878h-16.986v28.878h-16.987L297.069,181L322.55,151.272z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M217,241.154c0,2.124-1.722,3.846-3.845,3.846h-5.31c-2.124,0-3.845-1.722-3.845-3.846v-0.309
|
||||
c0-2.124,1.722-3.846,3.845-3.846h5.31c2.124,0,3.845,1.722,3.845,3.846V241.154z"/>
|
||||
<path fill="#FFFFFF" d="M207.859,256.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.357,0-2.457-1.567-2.457-3.5l0,0
|
||||
c0-1.933,1.1-3.5,2.457-3.5h12.046C206.759,253,207.859,254.567,207.859,256.5L207.859,256.5z"/>
|
||||
<path fill="#FFFFFF" d="M328.044,238.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689
|
||||
c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.403c6.518,0,11.984-1.032,16.402-3.094
|
||||
c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C329.629,244.418,329.1,241.115,328.044,238.021z
|
||||
M314.964,254.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103
|
||||
l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713
|
||||
C315.842,250.286,315.549,252.361,314.964,254.347z"/>
|
||||
<path fill="#FFFFFF" d="M246.148,241.043l1.373-9.61h21.424l1.336-9.434h-10.601h-24.38h-1.256c-2.125,0-3.846,1.877-3.846,4
|
||||
s1.721,4,3.846,4h0.096h3.793c1.928,0,3.491,1.563,3.491,3.491c0,1.928-1.563,3.491-3.491,3.491h-4.806L233.126,237h-8.983
|
||||
c-1.299,0-2.353,1.786-2.353,3.988c0,2.203,1.053,3.989,2.353,3.989h7.826L231.966,245h3.189c2.124,0,3.845,1.722,3.845,3.846
|
||||
v0.309c0,2.124-1.722,3.846-3.845,3.846h-4.349h-0.96H216.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.645h4.945h0.364
|
||||
c2.124,0,3.845,1.722,3.845,3.846v0.309c0,2.124-1.722,3.846-3.845,3.846h-1.524h-3.785h-1.8c-2.125,0-3.846,1.377-3.846,3.5
|
||||
s1.721,3.5,3.846,3.5h25.636c0.273,0,0.538-0.024,0.795-0.068h17.828l1.336-9.471h-26.045l1.795-13.062h18.751l1.336-9.471
|
||||
h-18.598l0.029-0.205C246.055,242.213,246.144,241.647,246.148,241.043z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g id="Marked_Letters_1_">
|
||||
<path fill="#010101" d="M619.045,356.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225
|
||||
l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L619.045,356.869z"/>
|
||||
<path fill="#010101" d="M660.617,356.869h-10.811l-1.084-8.994H636.33l-4.102,8.994h-10.605l20.566-40.605h10.986L660.617,356.869
|
||||
z M648.02,342.162l-1.934-15.527l-7.061,15.527H648.02z"/>
|
||||
<path fill="#010101" d="M701.713,356.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373
|
||||
c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.732,3.809
|
||||
s3.092,5.283,3.092,8.232c0,3.105-0.855,5.522-2.564,7.251s-4.097,2.798-7.162,3.208c1.562,0.898,2.768,1.953,3.617,3.164
|
||||
s1.861,3.096,3.033,5.654L701.713,356.869z M689.525,328.012c0-1.562-0.572-2.925-1.715-4.087s-3.452-1.743-6.928-1.743h-1.611
|
||||
l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S689.525,329.496,689.525,328.012z"/>
|
||||
<path fill="#010101" d="M747.705,316.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.281,21.65H705.02l6.064-40.605
|
||||
h10.4l-2.578,17.256l16.611-17.256H747.705z"/>
|
||||
<path fill="#010101" d="M780.426,316.264L779.4,323.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98
|
||||
l-1.025,7.266h-30.439l5.889-40.605H780.426z"/>
|
||||
<path fill="#010101" d="M823.953,336.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973
|
||||
s-7.583,2.373-12.582,2.373H782.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365
|
||||
s2.953,3.97,3.764,6.343S823.953,333.461,823.953,336.156z M813.377,336.303c0-2.031-0.387-4.004-1.158-5.918
|
||||
s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172
|
||||
s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C813.152,339.555,813.377,337.963,813.377,336.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M840.922,305.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211
|
||||
l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H840.922z
|
||||
"/>
|
||||
<path fill="#010101" d="M857.027,305.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02
|
||||
s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841
|
||||
s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604
|
||||
c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312
|
||||
c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874
|
||||
c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926
|
||||
C854.016,304.833,855.516,305.155,857.027,305.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M641,234.154c0,2.124-1.722,3.846-3.846,3.846h-5.309c-2.124,0-3.846-1.722-3.846-3.846v-0.309
|
||||
c0-2.124,1.722-3.846,3.846-3.846h5.309c2.124,0,3.846,1.722,3.846,3.846V234.154z"/>
|
||||
<path d="M631.859,249.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.356,0-2.456-1.567-2.456-3.5l0,0c0-1.933,1.1-3.5,2.456-3.5h12.046
|
||||
C630.76,246,631.859,247.567,631.859,249.5L631.859,249.5z"/>
|
||||
<path d="M752.044,231.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689
|
||||
c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.402c6.518,0,11.984-1.032,16.402-3.094
|
||||
c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C753.629,237.418,753.1,234.115,752.044,231.021z
|
||||
M738.964,247.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103
|
||||
l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713
|
||||
C739.842,243.286,739.549,245.361,738.964,247.347z"/>
|
||||
<path d="M670.148,234.043l1.373-9.61h21.424l1.337-9.434h-10.601h-24.381h-1.256c-2.124,0-3.846,1.877-3.846,4s1.722,4,3.846,4
|
||||
h0.096h3.793c1.929,0,3.492,1.563,3.492,3.491c0,1.928-1.563,3.491-3.492,3.491h-4.805L657.126,230h-8.983
|
||||
c-1.299,0-2.352,1.786-2.352,3.988c0,2.203,1.053,3.989,2.352,3.989h7.826L655.966,238h3.188c2.124,0,3.846,1.722,3.846,3.846
|
||||
v0.309c0,2.124-1.722,3.846-3.846,3.846h-4.349h-0.96H640.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.646h4.945h0.363
|
||||
c2.124,0,3.846,1.722,3.846,3.846v0.309c0,2.124-1.722,3.846-3.846,3.846h-1.523h-3.785h-1.801c-2.124,0-3.846,1.377-3.846,3.5
|
||||
s1.722,3.5,3.846,3.5h25.637c0.272,0,0.537-0.024,0.795-0.068h17.827l1.337-9.471h-26.045l1.795-13.062h18.75l1.337-9.471
|
||||
h-18.599l0.029-0.205C670.055,235.213,670.144,234.647,670.148,234.043z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M642.236,179.15v-33.125l16.988,21.234l16.986-21.234v33.125h16.987v-57.756h-16.987l-16.986,21.234
|
||||
l-16.988-21.234H625.25v57.756H642.236z"/>
|
||||
<path fill="#010101" d="M756.05,150.272h-16.987v-28.878h-16.986v28.878H705.09L730.569,180L756.05,150.272z"/>
|
||||
</g>
|
||||
<path fill="#010101" d="M776,90H606c-11.028,0-20,8.972-20,20v170c0,11.028,8.972,20,20,20h170c11.028,0,20-8.972,20-20V110
|
||||
C796,98.972,787.028,90,776,90z M606,100h170c5.514,0,10,4.486,10,10v83H596v-83C596,104.486,600.486,100,606,100z M776,290H606
|
||||
c-5.514,0-10-4.486-10-10v-82h190v82C786,285.514,781.514,290,776,290z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 11 KiB |
32
docs/img/logo-black.svg
Normal file
32
docs/img/logo-black.svg
Normal file
@ -0,0 +1,32 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="300px" height="439.589px" viewBox="100 100 400 400" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Marked_Letters">
|
||||
<path fill="#010101" d="M185.044,358.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225 l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L185.044,358.869z"/>
|
||||
<path fill="#010101" d="M226.617,358.869h-10.811l-1.084-8.994H202.33l-4.102,8.994h-10.605l20.566-40.605h10.986L226.617,358.869 z M214.019,344.162l-1.934-15.527l-7.061,15.527H214.019z"/>
|
||||
<path fill="#010101" d="M267.712,358.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373 c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.733,3.809 c2.061,2.539,3.091,5.283,3.091,8.232c0,3.105-0.854,5.522-2.563,7.251c-1.709,1.729-4.097,2.798-7.163,3.208 c1.562,0.898,2.769,1.953,3.618,3.164s1.86,3.096,3.032,5.654L267.712,358.869z M255.525,330.012c0-1.562-0.571-2.925-1.714-4.087 s-3.453-1.743-6.929-1.743h-1.611l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S255.525,331.496,255.525,330.012z"/>
|
||||
<path fill="#010101" d="M313.705,318.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.282,21.65h-10.342l6.064-40.605 h10.401l-2.578,17.256l16.611-17.256H313.705z"/>
|
||||
<path fill="#010101" d="M346.426,318.264L345.4,325.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98 l-1.025,7.266h-30.439l5.889-40.605H346.426z"/>
|
||||
<path fill="#010101" d="M389.953,338.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973 s-7.583,2.373-12.582,2.373H348.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365 s2.953,3.97,3.764,6.343S389.953,335.461,389.953,338.156z M379.377,338.303c0-2.031-0.387-4.004-1.158-5.918 s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172 s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C379.152,341.555,379.377,339.963,379.377,338.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M406.922,307.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211 l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H406.922z "/>
|
||||
<path fill="#010101" d="M423.027,307.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02 s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841 s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604 c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312 c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874 c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926 C420.016,306.833,421.516,307.155,423.027,307.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#010101" d="M357,200v-92c0-8.284-6.716-15-15-15H172c-8.284,0-15,6.716-15,15v92H357z"/>
|
||||
<path fill="#010101" d="M157,205v73c0,8.284,6.716,15,15,15h170c8.284,0,15-6.716,15-15v-73H157z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M208.737,180.15v-33.125l16.987,21.234l16.987-21.234v33.125h16.987v-57.756h-16.987l-16.987,21.234 l-16.987-21.234H191.75v57.756H208.737z"/>
|
||||
<path fill="#FFFFFF" d="M322.55,151.272h-16.987v-28.878h-16.986v28.878h-16.987L297.069,181L322.55,151.272z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M217,241.154c0,2.124-1.722,3.846-3.845,3.846h-5.31c-2.124,0-3.845-1.722-3.845-3.846v-0.309 c0-2.124,1.722-3.846,3.845-3.846h5.31c2.124,0,3.845,1.722,3.845,3.846V241.154z"/>
|
||||
<path fill="#FFFFFF" d="M207.859,256.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.357,0-2.457-1.567-2.457-3.5l0,0 c0-1.933,1.1-3.5,2.457-3.5h12.046C206.759,253,207.859,254.567,207.859,256.5L207.859,256.5z"/>
|
||||
<path fill="#FFFFFF" d="M328.044,238.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689 c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.403c6.518,0,11.984-1.032,16.402-3.094 c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C329.629,244.418,329.1,241.115,328.044,238.021z M314.964,254.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103 l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713 C315.842,250.286,315.549,252.361,314.964,254.347z"/>
|
||||
<path fill="#FFFFFF" d="M246.148,241.043l1.373-9.61h21.424l1.336-9.434h-10.601h-24.38h-1.256c-2.125,0-3.846,1.877-3.846,4 s1.721,4,3.846,4h0.096h3.793c1.928,0,3.491,1.563,3.491,3.491c0,1.928-1.563,3.491-3.491,3.491h-4.806L233.126,237h-8.983 c-1.299,0-2.353,1.786-2.353,3.988c0,2.203,1.053,3.989,2.353,3.989h7.826L231.966,245h3.189c2.124,0,3.845,1.722,3.845,3.846 v0.309c0,2.124-1.722,3.846-3.845,3.846h-4.349h-0.96H216.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.645h4.945h0.364 c2.124,0,3.845,1.722,3.845,3.846v0.309c0,2.124-1.722,3.846-3.845,3.846h-1.524h-3.785h-1.8c-2.125,0-3.846,1.377-3.846,3.5 s1.721,3.5,3.846,3.5h25.636c0.273,0,0.538-0.024,0.795-0.068h17.828l1.336-9.471h-26.045l1.795-13.062h18.751l1.336-9.471 h-18.598l0.029-0.205C246.055,242.213,246.144,241.647,246.148,241.043z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.5 KiB |
171
docs/index.html
Normal file
171
docs/index.html
Normal file
@ -0,0 +1,171 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked.js Documentation</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: relative;
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
header { display: flex; }
|
||||
|
||||
header h1 { margin: 0; }
|
||||
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0366d6;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
font-size: 85%;
|
||||
line-height: 1.45;
|
||||
background-color: #f6f8fa;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
code:not([class]) {
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: rgba(27,31,35,0.05);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.github-ribbon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<header>
|
||||
<a href="#/README.md">
|
||||
<img src="img/logo-black.svg" height="64px" width="64px" />
|
||||
</a>
|
||||
<h1>Marked.js Documentation</h1>
|
||||
</header>
|
||||
|
||||
<a href="https://github.com/markedjs/marked">
|
||||
<img class="github-ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
|
||||
</a>
|
||||
|
||||
<div id="content"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/unfetch/dist/unfetch.umd.js"></script>
|
||||
<script>
|
||||
if (!window.Promise) {
|
||||
window.Promise = ES6Promise;
|
||||
}
|
||||
if (!window.fetch) {
|
||||
window.fetch = unfetch;
|
||||
}
|
||||
|
||||
var content = document.querySelector('#content');
|
||||
var body = document.querySelector('html');
|
||||
var currentPage = 'README.md';
|
||||
var currentHash = '';
|
||||
var renderedPage = '';
|
||||
|
||||
function hashChange() {
|
||||
var hash = location.hash.slice(1);
|
||||
if (!hash) {
|
||||
hash = 'README.md';
|
||||
}
|
||||
|
||||
var uri = hash.split('#');
|
||||
|
||||
if (uri[0].match(/^\//)) {
|
||||
currentPage = uri[0].slice(1);
|
||||
if (uri.length > 1) {
|
||||
currentHash = uri[1];
|
||||
} else {
|
||||
currentHash = '';
|
||||
}
|
||||
} else {
|
||||
currentHash = uri[0];
|
||||
}
|
||||
|
||||
fetchPage(currentPage).then(function () {
|
||||
fetchAnchor(currentHash)
|
||||
});
|
||||
|
||||
history.replaceState('', document.title, '#/' + currentPage + (currentHash ? '#' + currentHash : ''));
|
||||
}
|
||||
|
||||
function fetchAnchor(anchor) {
|
||||
if (!anchor) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hashElement = document.getElementById(anchor);
|
||||
if (hashElement) {
|
||||
hashElement.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
function fetchPage(page) {
|
||||
if (page === renderedPage) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return fetch(page)
|
||||
.then(function (res) {
|
||||
if (!res.ok) {
|
||||
throw new Error('Error ' + res.status + ': ' + res.statusText);
|
||||
}
|
||||
return res.text();
|
||||
})
|
||||
.then(function (text) {
|
||||
renderedPage = page;
|
||||
content.innerHTML = marked(text);
|
||||
body.scrollTop = 0;
|
||||
}).catch(function (e) {
|
||||
content.innerHTML = '<p>Oops! There was a problem rendering the page.</p>'
|
||||
+ '<p>' + e.message + '</p>';
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', function (e) {
|
||||
e.preventDefault();
|
||||
hashChange();
|
||||
});
|
||||
|
||||
hashChange();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
11
jasmine.json
Normal file
11
jasmine.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"spec_dir": "test",
|
||||
"spec_files": [
|
||||
"**/*-spec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/**/*.js"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": true
|
||||
}
|
684
lib/marked.js
684
lib/marked.js
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ cat in.md | marked > out.html
|
||||
.TP
|
||||
echo "hello *world*" | marked
|
||||
.TP
|
||||
marked \-o out.html in.md \-\-gfm
|
||||
marked \-o out.html \-i in.md \-\-gfm
|
||||
.TP
|
||||
marked \-\-output="hello world.html" \-i in.md \-\-no-breaks
|
||||
|
||||
@ -81,7 +81,7 @@ For configuring and running programmatically.
|
||||
require('marked')('*foo*', { gfm: true });
|
||||
|
||||
.SH BUGS
|
||||
Please report any bugs to https://github.com/chjj/marked.
|
||||
Please report any bugs to https://github.com/markedjs/marked.
|
||||
|
||||
.SH LICENSE
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
||||
|
@ -22,7 +22,7 @@ EXAMPLES
|
||||
|
||||
echo "hello *world*" | marked
|
||||
|
||||
marked -o out.html in.md --gfm
|
||||
marked -o out.html -i in.md --gfm
|
||||
|
||||
marked --output="hello world.html" -i in.md --no-breaks
|
||||
|
||||
|
4
marked.min.js
vendored
4
marked.min.js
vendored
File diff suppressed because one or more lines are too long
2870
package-lock.json
generated
2870
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@ -2,14 +2,14 @@
|
||||
"name": "marked",
|
||||
"description": "A markdown parser built for speed",
|
||||
"author": "Christopher Jeffrey",
|
||||
"version": "0.3.12",
|
||||
"version": "0.3.19",
|
||||
"main": "./lib/marked.js",
|
||||
"bin": "./bin/marked",
|
||||
"man": "./man/marked.1",
|
||||
"repository": "git://github.com/chjj/marked.git",
|
||||
"homepage": "https://github.com/chjj/marked",
|
||||
"repository": "git://github.com/markedjs/marked.git",
|
||||
"homepage": "https://marked.js.org",
|
||||
"bugs": {
|
||||
"url": "http://github.com/chjj/marked/issues"
|
||||
"url": "http://github.com/markedjs/marked/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
@ -23,17 +23,39 @@
|
||||
"html"
|
||||
],
|
||||
"devDependencies": {
|
||||
"markdown": "*",
|
||||
"showdown": "*",
|
||||
"markdown-it": "*",
|
||||
"eslint": "^4.15.0",
|
||||
"eslint-config-standard": "^11.0.0-beta.0",
|
||||
"eslint-plugin-import": "^2.8.0",
|
||||
"eslint-plugin-node": "^5.2.1",
|
||||
"eslint-plugin-promise": "^3.6.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"eslint-plugin-vuln-regex-detector": "^1.0.4",
|
||||
"front-matter": "^2.3.0",
|
||||
"glob-to-regexp": "0.3.0",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-uglify": "^1.1.0",
|
||||
"gulp-concat": "^2.5.2"
|
||||
"html-differ": "^1.3.4",
|
||||
"jasmine": "^3.1.0",
|
||||
"jasmine2-custom-message": "^0.9.0",
|
||||
"markdown": "*",
|
||||
"markdown-it": "*",
|
||||
"showdown": "*",
|
||||
"uglify-js": "^3.3.10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test",
|
||||
"bench": "node test --bench"
|
||||
"test": "jasmine --config=jasmine.json",
|
||||
"test:unit": "npm test -- test/unit/**/*-spec.js",
|
||||
"test:specs": "npm test -- test/specs/**/*-spec.js",
|
||||
"test:cm": "npm test -- test/specs/commonmark/**/*-spec.js",
|
||||
"test:gfm": "npm test -- test/specs/gfm/**/*-spec.js",
|
||||
"test:marked": "npm test -- test/specs/marked/**/*-spec.js",
|
||||
"test:old": "node test",
|
||||
"test:lint": "eslint bin/marked .",
|
||||
"test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js",
|
||||
"bench": "node test --bench",
|
||||
"lint": "eslint --fix bin/marked .",
|
||||
"build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
|
||||
"preversion": "npm run build && (git diff --quiet || git commit -am 'minify')"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
var fs = require('fs');
|
||||
var fs = require('fs'),
|
||||
path = require('path');
|
||||
|
||||
var test = require('../')
|
||||
, runTests = test.runTests
|
||||
, load = test.load;
|
||||
var testMod = require('../'),
|
||||
load = testMod.load;
|
||||
|
||||
var express = require('express')
|
||||
, app = express();
|
||||
var express = require('express'),
|
||||
app = express();
|
||||
|
||||
var files = load();
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
var setHeader = res.setHeader;
|
||||
@ -21,21 +23,17 @@ app.use(function(req, res, next) {
|
||||
next();
|
||||
});
|
||||
|
||||
var dir = __dirname + '/../tests'
|
||||
, files = {};
|
||||
|
||||
app.get('/test.js', function(req, res, next) {
|
||||
var test = fs.readFileSync(__dirname + '/test.js', 'utf8')
|
||||
, files = load();
|
||||
|
||||
test = test.replace('__TESTS__', JSON.stringify(files));
|
||||
test = test.replace('__MAIN__', runTests + '');
|
||||
var test = fs.readFileSync(path.join(__dirname, 'test.js'), 'utf8');
|
||||
var testScript = test.replace('__TESTS__', JSON.stringify(files))
|
||||
.replace('__MAIN__', testMod.runTests + '')
|
||||
.replace('__LIBS__', testMod.testFile + '');
|
||||
|
||||
res.contentType('.js');
|
||||
res.send(test);
|
||||
res.send(testScript);
|
||||
});
|
||||
|
||||
app.use(express.static(__dirname + '/../../lib'));
|
||||
app.use(express.static(path.join(__dirname, '/../../lib')));
|
||||
app.use(express.static(__dirname));
|
||||
|
||||
app.listen(8080);
|
||||
|
@ -1,62 +1,66 @@
|
||||
|
||||
;(function() {
|
||||
var console = {},
|
||||
files = __TESTS__; // eslint-disable-line no-undef
|
||||
|
||||
var console = {}
|
||||
, files = __TESTS__;
|
||||
console.log = function(text) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
i = 0;
|
||||
|
||||
console.log = function(text) {
|
||||
var args = Array.prototype.slice.call(arguments, 1)
|
||||
, i = 0;
|
||||
text = text.replace(/%\w/g, function() {
|
||||
return args[i++] || '';
|
||||
});
|
||||
|
||||
text = text.replace(/%\w/g, function() {
|
||||
return args[i++] || '';
|
||||
});
|
||||
if (window.console) window.console.log(text);
|
||||
document.body.innerHTML += '<pre>' + escape(text) + '</pre>';
|
||||
};
|
||||
|
||||
if (window.console) window.console.log(text);
|
||||
document.body.innerHTML += '<pre>' + escape(text) + '</pre>';
|
||||
};
|
||||
if (!Object.keys) {
|
||||
Object.keys = function(obj) {
|
||||
var out = [],
|
||||
key;
|
||||
|
||||
if (!Object.keys) {
|
||||
Object.keys = function(obj) {
|
||||
var out = []
|
||||
, key;
|
||||
|
||||
for (key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
out.push(key);
|
||||
for (key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
out.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
}
|
||||
return out;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function(callback, context) {
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
callback.call(context || null, this[i], i, obj);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (!Array.prototype.forEach) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Array.prototype.forEach = function(callback, context) {
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
callback.call(context || null, this[i], i, this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.trim) {
|
||||
String.prototype.trim = function() {
|
||||
return this.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
}
|
||||
if (!String.prototype.trim) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
String.prototype.trim = function() {
|
||||
return this.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
}
|
||||
|
||||
function load() {
|
||||
return files;
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function load() {
|
||||
return files;
|
||||
}
|
||||
|
||||
function escape(html, encode) {
|
||||
return html
|
||||
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
function escape(html, encode) {
|
||||
return html
|
||||
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
(__MAIN__)();
|
||||
__LIBS__; // eslint-disable-line no-undef, no-unused-expressions
|
||||
|
||||
(__MAIN__)(); // eslint-disable-line no-undef
|
||||
}).call(this);
|
||||
|
5
test/helpers/helpers.js
Normal file
5
test/helpers/helpers.js
Normal file
@ -0,0 +1,5 @@
|
||||
var marked = require('../../lib/marked.js');
|
||||
|
||||
beforeEach(function () {
|
||||
marked.setOptions(marked.getDefaults());
|
||||
});
|
288
test/index.js
vendored
288
test/index.js
vendored
@ -3,48 +3,47 @@
|
||||
/**
|
||||
* marked tests
|
||||
* Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
|
||||
* https://github.com/chjj/marked
|
||||
* https://github.com/markedjs/marked
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, path = require('path')
|
||||
, fm = require('front-matter')
|
||||
, g2r = require('glob-to-regexp')
|
||||
, marked = require('../');
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
fm = require('front-matter'),
|
||||
g2r = require('glob-to-regexp'),
|
||||
marked = require('../'),
|
||||
markedMin = require('../marked.min.js');
|
||||
|
||||
/**
|
||||
* Load Tests
|
||||
*/
|
||||
|
||||
function load(options) {
|
||||
var dir = __dirname + '/compiled_tests'
|
||||
, files = {}
|
||||
, list
|
||||
, file
|
||||
, name
|
||||
, content
|
||||
, regex
|
||||
, skip
|
||||
, glob = g2r(options.glob || "*", { extended: true })
|
||||
, i
|
||||
, j
|
||||
, l;
|
||||
options = options || {};
|
||||
var dir = path.join(__dirname, 'compiled_tests'),
|
||||
files = {},
|
||||
list,
|
||||
file,
|
||||
name,
|
||||
content,
|
||||
glob = g2r(options.glob || '*', { extended: true }),
|
||||
i,
|
||||
l;
|
||||
|
||||
list = fs
|
||||
.readdirSync(dir)
|
||||
.filter(function(file) {
|
||||
return path.extname(file) !== '.html';
|
||||
return path.extname(file) === '.md';
|
||||
})
|
||||
.sort();
|
||||
|
||||
l = list.length;
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
name = path.basename(list[i], ".md");
|
||||
name = path.basename(list[i], '.md');
|
||||
if (glob.test(name)) {
|
||||
file = path.join(dir, list[i]);
|
||||
content = fm(fs.readFileSync(file, 'utf8'));
|
||||
@ -61,7 +60,7 @@ function load(options) {
|
||||
if (!options.glob) {
|
||||
// Change certain tests to allow
|
||||
// comparison to older benchmark times.
|
||||
fs.readdirSync(__dirname + '/new').forEach(function(name) {
|
||||
fs.readdirSync(path.join(__dirname, 'new')).forEach(function(name) {
|
||||
if (path.extname(name) === '.html') return;
|
||||
if (name === 'main.md') return;
|
||||
delete files[name];
|
||||
@ -92,112 +91,131 @@ function runTests(engine, options) {
|
||||
engine = null;
|
||||
}
|
||||
|
||||
var engine = engine || marked
|
||||
, options = options || {}
|
||||
, files = options.files || load(options)
|
||||
, complete = 0
|
||||
, failed = 0
|
||||
, failures = []
|
||||
, keys = Object.keys(files)
|
||||
, i = 0
|
||||
, len = keys.length
|
||||
, filename
|
||||
, file
|
||||
, opts
|
||||
, text
|
||||
, html
|
||||
, j
|
||||
, l;
|
||||
engine = engine || marked;
|
||||
options = options || {};
|
||||
var succeeded = 0,
|
||||
failed = 0,
|
||||
files = options.files || load(options),
|
||||
filenames = Object.keys(files),
|
||||
len = filenames.length,
|
||||
success,
|
||||
i,
|
||||
filename,
|
||||
file;
|
||||
|
||||
if (options.marked) {
|
||||
marked.setOptions(options.marked);
|
||||
}
|
||||
|
||||
main:
|
||||
for (; i < len; i++) {
|
||||
filename = keys[i];
|
||||
for (i = 0; i < len; i++) {
|
||||
filename = filenames[i];
|
||||
file = files[filename];
|
||||
opts = Object.keys(file.options);
|
||||
|
||||
if (marked._original) {
|
||||
marked.defaults = marked._original;
|
||||
delete marked._original;
|
||||
}
|
||||
success = testFile(engine, file, filename, i + 1);
|
||||
|
||||
if (opts.length) {
|
||||
marked._original = marked.defaults;
|
||||
marked.defaults = {};
|
||||
Object.keys(marked._original).forEach(function(key) {
|
||||
marked.defaults[key] = marked._original[key];
|
||||
});
|
||||
opts.forEach(function(key) {
|
||||
if (marked.defaults.hasOwnProperty(key)) {
|
||||
marked.defaults[key] = file.options[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
text = engine(file.text).replace(/\s/g, '');
|
||||
html = file.html.replace(/\s/g, '');
|
||||
} catch (e) {
|
||||
console.log('%s failed.', filename);
|
||||
throw e;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
l = html.length;
|
||||
|
||||
for (; j < l; j++) {
|
||||
if (text[j] !== html[j]) {
|
||||
failed++;
|
||||
failures.push(filename);
|
||||
|
||||
text = text.substring(
|
||||
Math.max(j - 30, 0),
|
||||
Math.min(j + 30, text.length));
|
||||
|
||||
html = html.substring(
|
||||
Math.max(j - 30, 0),
|
||||
Math.min(j + 30, html.length));
|
||||
|
||||
console.log(
|
||||
'\n#%d. %s failed at offset %d. Near: "%s".\n',
|
||||
i + 1, filename, j, text);
|
||||
|
||||
console.log('\nGot:\n%s\n', text.trim() || text);
|
||||
console.log('\nExpected:\n%s\n', html.trim() || html);
|
||||
|
||||
if (options.stop) {
|
||||
break main;
|
||||
}
|
||||
|
||||
continue main;
|
||||
if (success) {
|
||||
succeeded++;
|
||||
} else {
|
||||
failed++;
|
||||
if (options.stop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
complete++;
|
||||
console.log('#%d. %s completed.', i + 1, filename);
|
||||
}
|
||||
|
||||
console.log('%d/%d tests completed successfully.', complete, len);
|
||||
console.log('%d/%d tests completed successfully.', succeeded, len);
|
||||
if (failed) console.log('%d/%d tests failed.', failed, len);
|
||||
|
||||
return !failed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a file
|
||||
*/
|
||||
|
||||
function testFile(engine, file, filename, index) {
|
||||
var opts = Object.keys(file.options),
|
||||
text,
|
||||
html,
|
||||
j,
|
||||
l,
|
||||
before,
|
||||
elapsed;
|
||||
|
||||
if (marked._original) {
|
||||
marked.defaults = marked._original;
|
||||
delete marked._original;
|
||||
}
|
||||
|
||||
console.log('#%d. Test %s', index, filename);
|
||||
|
||||
if (opts.length) {
|
||||
marked._original = marked.defaults;
|
||||
marked.defaults = {};
|
||||
Object.keys(marked._original).forEach(function(key) {
|
||||
marked.defaults[key] = marked._original[key];
|
||||
});
|
||||
opts.forEach(function(key) {
|
||||
if (marked.defaults.hasOwnProperty(key)) {
|
||||
marked.defaults[key] = file.options[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
before = process.hrtime();
|
||||
try {
|
||||
text = engine(file.text).replace(/\s/g, '');
|
||||
html = file.html.replace(/\s/g, '');
|
||||
} catch (e) {
|
||||
elapsed = process.hrtime(before);
|
||||
console.log(' failed in %dms', prettyElapsedTime(elapsed));
|
||||
throw e;
|
||||
}
|
||||
|
||||
elapsed = process.hrtime(before);
|
||||
|
||||
l = html.length;
|
||||
|
||||
for (j = 0; j < l; j++) {
|
||||
if (text[j] !== html[j]) {
|
||||
text = text.substring(
|
||||
Math.max(j - 30, 0),
|
||||
Math.min(j + 30, text.length));
|
||||
|
||||
html = html.substring(
|
||||
Math.max(j - 30, 0),
|
||||
Math.min(j + 30, l));
|
||||
|
||||
console.log(' failed in %dms at offset %d. Near: "%s".\n', prettyElapsedTime(elapsed), j, text);
|
||||
|
||||
console.log('\nGot:\n%s\n', text.trim() || text);
|
||||
console.log('\nExpected:\n%s\n', html.trim() || html);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (elapsed[0] > 0) {
|
||||
console.log(' failed because it took too long.\n\n passed in %dms', prettyElapsedTime(elapsed));
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(' passed in %dms', prettyElapsedTime(elapsed));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Benchmark a function
|
||||
*/
|
||||
|
||||
function bench(name, files, func) {
|
||||
var start = Date.now()
|
||||
, times = 1000
|
||||
, keys = Object.keys(files)
|
||||
, i
|
||||
, l = keys.length
|
||||
, filename
|
||||
, file;
|
||||
var start = Date.now(),
|
||||
times = 1000,
|
||||
keys = Object.keys(files),
|
||||
i,
|
||||
l = keys.length,
|
||||
filename,
|
||||
file;
|
||||
|
||||
while (times--) {
|
||||
for (i = 0; i < l; i++) {
|
||||
@ -215,8 +233,8 @@ function bench(name, files, func) {
|
||||
*/
|
||||
|
||||
function runBench(options) {
|
||||
var options = options || {}
|
||||
, files = load(options);
|
||||
options = options || {};
|
||||
var files = load(options);
|
||||
|
||||
// Non-GFM, Non-pedantic
|
||||
marked.setOptions({
|
||||
@ -313,8 +331,8 @@ function runBench(options) {
|
||||
*/
|
||||
|
||||
function time(options) {
|
||||
var options = options || {}
|
||||
, files = load(options);
|
||||
options = options || {};
|
||||
var files = load(options);
|
||||
if (options.marked) {
|
||||
marked.setOptions(options.marked);
|
||||
}
|
||||
@ -336,7 +354,7 @@ function time(options) {
|
||||
function fix() {
|
||||
['compiled_tests', 'original', 'new'].forEach(function(dir) {
|
||||
try {
|
||||
fs.mkdirSync(path.resolve(__dirname, dir), 0o755);
|
||||
fs.mkdirSync(path.resolve(__dirname, dir));
|
||||
} catch (e) {
|
||||
;
|
||||
}
|
||||
@ -349,23 +367,28 @@ function fix() {
|
||||
|
||||
// cp -r original tests
|
||||
fs.readdirSync(path.resolve(__dirname, 'original')).forEach(function(file) {
|
||||
var text = fs.readFileSync(path.resolve(__dirname, 'original', file));
|
||||
var text = fs.readFileSync(path.resolve(__dirname, 'original', file), 'utf8');
|
||||
|
||||
if (file === 'hard_wrapped_paragraphs_with_list_like_lines.md') {
|
||||
text = '---\ngfm: false\n---\n' + text;
|
||||
if (path.extname(file) === '.md') {
|
||||
if (fm.test(text)) {
|
||||
text = fm(text);
|
||||
text = '---\n' + text.frontmatter + '\ngfm: false\n---\n' + text.body;
|
||||
} else {
|
||||
text = '---\ngfm: false\n---\n' + text;
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.resolve(__dirname, 'compiled_tests', file), text);
|
||||
});
|
||||
|
||||
// node fix.js
|
||||
var dir = __dirname + '/compiled_tests';
|
||||
var dir = path.join(__dirname, 'compiled_tests');
|
||||
|
||||
fs.readdirSync(dir).filter(function(file) {
|
||||
return path.extname(file) === '.html';
|
||||
}).forEach(function(file) {
|
||||
var file = path.join(dir, file)
|
||||
, html = fs.readFileSync(file, 'utf8');
|
||||
file = path.join(dir, file);
|
||||
var html = fs.readFileSync(file, 'utf8');
|
||||
|
||||
// fix unencoded quotes
|
||||
html = html
|
||||
@ -385,7 +408,7 @@ function fix() {
|
||||
.replace(/</g, '<')
|
||||
.replace(/&/g, '&');
|
||||
|
||||
id = id.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
id = id.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
|
||||
return '<' + h + ' id="' + id + '">' + text + '</' + h + '>';
|
||||
});
|
||||
@ -395,8 +418,8 @@ function fix() {
|
||||
|
||||
// turn <hr /> into <hr>
|
||||
fs.readdirSync(dir).forEach(function(file) {
|
||||
var file = path.join(dir, file)
|
||||
, text = fs.readFileSync(file, 'utf8');
|
||||
file = path.join(dir, file);
|
||||
var text = fs.readFileSync(file, 'utf8');
|
||||
|
||||
text = text.replace(/(<|<)hr\s*\/(>|>)/g, '$1hr$2');
|
||||
|
||||
@ -424,12 +447,12 @@ function fix() {
|
||||
* Argument Parsing
|
||||
*/
|
||||
|
||||
function parseArg(argv) {
|
||||
var argv = process.argv.slice(2)
|
||||
, options = {}
|
||||
, opt = ""
|
||||
, orphans = []
|
||||
, arg;
|
||||
function parseArg() {
|
||||
var argv = process.argv.slice(2),
|
||||
options = {},
|
||||
opt = '',
|
||||
orphans = [],
|
||||
arg;
|
||||
|
||||
function getarg() {
|
||||
var arg = argv.shift();
|
||||
@ -485,6 +508,10 @@ function parseArg(argv) {
|
||||
case '--time':
|
||||
options.time = true;
|
||||
break;
|
||||
case '-m':
|
||||
case '--minified':
|
||||
options.minified = true;
|
||||
break;
|
||||
case '--glob':
|
||||
arg = argv.shift();
|
||||
options.glob = arg.replace(/^=/, '');
|
||||
@ -549,6 +576,9 @@ function main(argv) {
|
||||
return time(opt);
|
||||
}
|
||||
|
||||
if (opt.minified) {
|
||||
marked = markedMin;
|
||||
}
|
||||
return runTests(opt);
|
||||
}
|
||||
|
||||
@ -563,8 +593,16 @@ if (!module.parent) {
|
||||
exports = main;
|
||||
exports.main = main;
|
||||
exports.runTests = runTests;
|
||||
exports.testFile = testFile;
|
||||
exports.runBench = runBench;
|
||||
exports.load = load;
|
||||
exports.bench = bench;
|
||||
module.exports = exports;
|
||||
}
|
||||
|
||||
// returns time to millisecond granularity
|
||||
function prettyElapsedTime(hrtimeElapsed) {
|
||||
var seconds = hrtimeElapsed[0];
|
||||
var frac = Math.round(hrtimeElapsed[1] / 1e3) / 1e3;
|
||||
return seconds * 1e3 + frac;
|
||||
}
|
||||
|
91
test/new/cm_autolinks.html
Normal file
91
test/new/cm_autolinks.html
Normal file
@ -0,0 +1,91 @@
|
||||
<p>Here are some valid autolinks:</p>
|
||||
|
||||
<h3 id="example-565">Example 565</h3>
|
||||
|
||||
<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p>
|
||||
|
||||
<h3 id="example-566">Example 566</h3>
|
||||
|
||||
<p><a href="http://foo.bar.baz/test?q=hello&id=22&boolean">http://foo.bar.baz/test?q=hello&id=22&boolean</a></p>
|
||||
|
||||
<h3 id="example-567">Example 567</h3>
|
||||
|
||||
<p><a href="irc://foo.bar:2233/baz">irc://foo.bar:2233/baz</a></p>
|
||||
|
||||
<h3 id="example-568">Example 568</h3>
|
||||
|
||||
<p>Uppercase is also fine:</p>
|
||||
|
||||
<p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p>
|
||||
|
||||
<p>Note that many strings that count as absolute URIs for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax:</p>
|
||||
|
||||
<h3 id="example-569">Example 569</h3>
|
||||
|
||||
<p><a href="a+b+c:d">a+b+c:d</a></p>
|
||||
|
||||
<h3 id="example-570">Example 570</h3>
|
||||
|
||||
<p><a href="made-up-scheme://foo,bar">made-up-scheme://foo,bar</a></p>
|
||||
|
||||
<h3 id="example-571">Example 571</h3>
|
||||
|
||||
<p><a href="http://../">http://../</a></p>
|
||||
|
||||
<h3 id="example-572">Example 572</h3>
|
||||
|
||||
<p><a href="localhost:5001/foo">localhost:5001/foo</a></p>
|
||||
|
||||
<h3 id="example-573">Example 573</h3>
|
||||
|
||||
<p>Spaces are not allowed in autolinks:</p>
|
||||
|
||||
<p><http://foo.bar/baz bim></p>
|
||||
|
||||
<h3 id="example-574">Example 574</h3>
|
||||
|
||||
<p>Backslash-escapes do not work inside autolinks:</p>
|
||||
|
||||
<p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p>
|
||||
|
||||
<p>Examples of email autolinks:</p>
|
||||
|
||||
<h3 id="example-575">Example 575</h3>
|
||||
|
||||
<p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p>
|
||||
|
||||
<h3 id="example-576">Example 576</h3>
|
||||
|
||||
<p><a href="mailto:foo+special@Bar.baz-bar0.com">foo+special@Bar.baz-bar0.com</a></p>
|
||||
|
||||
<h3 id="example-577">Example 577</h3>
|
||||
|
||||
<p>Backslash-escapes do not work inside email autolinks:</p>
|
||||
|
||||
<p><foo+@bar.example.com></p>
|
||||
|
||||
<p>These are not autolinks:</p>
|
||||
|
||||
<h3 id="example-578">Example 578</h3>
|
||||
|
||||
<p><></p>
|
||||
|
||||
<h3 id="example-579">Example 579</h3>
|
||||
|
||||
<p>< http://foo.bar ></p>
|
||||
|
||||
<h3 id="example-580">Example 580</h3>
|
||||
|
||||
<p><m:abc></p>
|
||||
|
||||
<h3 id="example-581">Example 581</h3>
|
||||
|
||||
<p><foo.bar.baz></p>
|
||||
|
||||
<h3 id="example-582">Example 582</h3>
|
||||
|
||||
<p>http://example.com</p>
|
||||
|
||||
<h3 id="example-583">Example 583</h3>
|
||||
|
||||
<p>foo@bar.example.com</p>
|
96
test/new/cm_autolinks.md
Normal file
96
test/new/cm_autolinks.md
Normal file
@ -0,0 +1,96 @@
|
||||
---
|
||||
gfm: false
|
||||
mangle: false
|
||||
---
|
||||
|
||||
Here are some valid autolinks:
|
||||
|
||||
### Example 565
|
||||
|
||||
<http://foo.bar.baz>
|
||||
|
||||
### Example 566
|
||||
|
||||
<http://foo.bar.baz/test?q=hello&id=22&boolean>
|
||||
|
||||
### Example 567
|
||||
|
||||
<irc://foo.bar:2233/baz>
|
||||
|
||||
### Example 568
|
||||
|
||||
Uppercase is also fine:
|
||||
|
||||
<MAILTO:FOO@BAR.BAZ>
|
||||
|
||||
Note that many strings that count as absolute URIs for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax:
|
||||
|
||||
### Example 569
|
||||
|
||||
<a+b+c:d>
|
||||
|
||||
### Example 570
|
||||
|
||||
<made-up-scheme://foo,bar>
|
||||
|
||||
### Example 571
|
||||
|
||||
<http://../>
|
||||
|
||||
### Example 572
|
||||
|
||||
<localhost:5001/foo>
|
||||
|
||||
### Example 573
|
||||
|
||||
Spaces are not allowed in autolinks:
|
||||
|
||||
<http://foo.bar/baz bim>
|
||||
|
||||
### Example 574
|
||||
|
||||
Backslash-escapes do not work inside autolinks:
|
||||
|
||||
<http://example.com/\[\>
|
||||
|
||||
Examples of email autolinks:
|
||||
|
||||
### Example 575
|
||||
|
||||
<foo@bar.example.com>
|
||||
|
||||
### Example 576
|
||||
|
||||
<foo+special@Bar.baz-bar0.com>
|
||||
|
||||
### Example 577
|
||||
|
||||
Backslash-escapes do not work inside email autolinks:
|
||||
|
||||
<foo\+@bar.example.com>
|
||||
|
||||
These are not autolinks:
|
||||
|
||||
### Example 578
|
||||
|
||||
<>
|
||||
|
||||
### Example 579
|
||||
|
||||
< http://foo.bar >
|
||||
|
||||
### Example 580
|
||||
|
||||
<m:abc>
|
||||
|
||||
### Example 581
|
||||
|
||||
<foo.bar.baz>
|
||||
|
||||
### Example 582
|
||||
|
||||
http://example.com
|
||||
|
||||
### Example 583
|
||||
|
||||
foo@bar.example.com
|
239
test/new/cm_blockquotes.html
Normal file
239
test/new/cm_blockquotes.html
Normal file
@ -0,0 +1,239 @@
|
||||
<h3 id="example-191">Example 191</h3>
|
||||
|
||||
<blockquote>
|
||||
<h1 id="foo">Foo</h1>
|
||||
<p>bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-192">Example 192</h3>
|
||||
|
||||
<p>The spaces after the <code>></code> characters can be omitted:</p>
|
||||
|
||||
<blockquote>
|
||||
<h1 id="foo">Foo</h1>
|
||||
<p>bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-193">Example 193</h3>
|
||||
|
||||
<p>The <code>></code> characters can be indented 1-3 spaces:</p>
|
||||
|
||||
<blockquote>
|
||||
<h1 id="foo">Foo</h1>
|
||||
<p>bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-194">Example 194</h3>
|
||||
|
||||
<p>Four spaces gives us a code block:</p>
|
||||
|
||||
<pre><code>> # Foo
|
||||
> bar
|
||||
> baz
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-195">Example 195</h3>
|
||||
|
||||
<p>The Laziness clause allows us to omit the <code>></code> before paragraph continuation text:</p>
|
||||
|
||||
<blockquote>
|
||||
<h1 id="foo">Foo</h1>
|
||||
<p>bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-196">Example 196</h3>
|
||||
|
||||
<p>A block quote can contain some lazy and some non-lazy continuation lines:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>bar
|
||||
baz
|
||||
foo</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-197">Example 197</h3>
|
||||
|
||||
<p>Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with block quote markers. For example, the <code>></code> cannot be omitted in the second line of</p>
|
||||
|
||||
<blockquote>
|
||||
<p>foo</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
|
||||
<p>without changing the meaning.</p>
|
||||
|
||||
<h3 id="example-198">Example 198</h3>
|
||||
|
||||
<pre><code>Similarly, if we omit the `>` in the second line then the block quote ends after the first line:
|
||||
|
||||
> - foo
|
||||
- bar</code></pre>
|
||||
|
||||
<h3 id="example-199">Example 199</h3>
|
||||
|
||||
<p>For the same reason, we can’t omit the <code>></code> in front of subsequent lines of an indented or fenced code block:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre><code>foo
|
||||
</code></pre>
|
||||
</blockquote>
|
||||
<pre><code>bar
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-200">Example 200</h3>
|
||||
|
||||
<pre><code>> ```
|
||||
foo
|
||||
```
|
||||
|
||||
<blockquote>
|
||||
<pre><code></code></pre>
|
||||
</blockquote>
|
||||
<p>foo</p>
|
||||
<pre><code></code></pre>
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-201">Example 201</h3>
|
||||
<pre><code>> foo
|
||||
- bar
|
||||
|
||||
<blockquote>
|
||||
<p>foo
|
||||
- bar</p>
|
||||
</blockquote>
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-202">Example 202</h3>
|
||||
|
||||
<p>A block quote can be empty:</p>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-203">Example 203</h3>
|
||||
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-204">Example 204</h3>
|
||||
|
||||
<p>A block quote can have initial or final blank lines:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>foo</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3 id="example-205">Example 205</h3>
|
||||
|
||||
<p>A blank line always separates block quotes:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>foo</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-206">Example 206</h3>
|
||||
|
||||
<p>Consecutiveness means that if we put these block quotes together, we get a single block quote:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>foo
|
||||
bar</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-207">Example 207</h3>
|
||||
|
||||
<p>To get a block quote with two paragraphs, use:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>foo</p>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-208">Example 208</h3>
|
||||
|
||||
<p>Block quotes can interrupt paragraphs:</p>
|
||||
|
||||
<p>foo</p>
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-209">Example 209</h3>
|
||||
|
||||
<p>In general, blank lines are not needed before or after block quotes:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>aaa</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<blockquote>
|
||||
<p>bbb</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-210">Example 210</h3>
|
||||
|
||||
<p>However, because of laziness, a blank line is needed between a block quote and a following paragraph:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-211">Example 211</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
<p>baz</p>
|
||||
|
||||
<h3 id="example-212">Example 212</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
<p>baz</p>
|
||||
|
||||
<h3 id="example-213">Example 213</h3>
|
||||
|
||||
<p>It is a consequence of the Laziness rule that any number of initial <code>></code>s may be omitted on a continuation line of a nested block quote:</p>
|
||||
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>foo
|
||||
bar</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-214">Example 214</h3>
|
||||
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>foo
|
||||
bar
|
||||
baz</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-215">Example 215</h3>
|
||||
|
||||
<p>When including an indented code block in a block quote, remember that the block quote marker includes both the <code>></code> and a following space. So five spaces are needed after the <code>></code>:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre><code>code
|
||||
</code></pre>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p>not code</p>
|
||||
</blockquote>
|
189
test/new/cm_blockquotes.md
Normal file
189
test/new/cm_blockquotes.md
Normal file
@ -0,0 +1,189 @@
|
||||
### Example 191
|
||||
|
||||
> # Foo
|
||||
> bar
|
||||
> baz
|
||||
|
||||
### Example 192
|
||||
|
||||
The spaces after the `>` characters can be omitted:
|
||||
|
||||
># Foo
|
||||
>bar
|
||||
> baz
|
||||
|
||||
### Example 193
|
||||
|
||||
The `>` characters can be indented 1-3 spaces:
|
||||
|
||||
> # Foo
|
||||
> bar
|
||||
> baz
|
||||
|
||||
### Example 194
|
||||
|
||||
Four spaces gives us a code block:
|
||||
|
||||
> # Foo
|
||||
> bar
|
||||
> baz
|
||||
|
||||
### Example 195
|
||||
|
||||
The Laziness clause allows us to omit the `>` before paragraph continuation text:
|
||||
|
||||
> # Foo
|
||||
> bar
|
||||
baz
|
||||
|
||||
### Example 196
|
||||
|
||||
A block quote can contain some lazy and some non-lazy continuation lines:
|
||||
|
||||
> bar
|
||||
baz
|
||||
> foo
|
||||
|
||||
### Example 197
|
||||
|
||||
Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with block quote markers. For example, the `>` cannot be omitted in the second line of
|
||||
|
||||
> foo
|
||||
---
|
||||
|
||||
without changing the meaning.
|
||||
|
||||
### Example 198
|
||||
|
||||
Similarly, if we omit the `>` in the second line then the block quote ends after the first line:
|
||||
|
||||
> - foo
|
||||
- bar
|
||||
|
||||
### Example 199
|
||||
|
||||
For the same reason, we can’t omit the `>` in front of subsequent lines of an indented or fenced code block:
|
||||
|
||||
> foo
|
||||
|
||||
bar
|
||||
|
||||
### Example 200
|
||||
|
||||
> ```
|
||||
foo
|
||||
```
|
||||
|
||||
<blockquote>
|
||||
<pre><code></code></pre>
|
||||
</blockquote>
|
||||
<p>foo</p>
|
||||
<pre><code></code></pre>
|
||||
|
||||
### Example 201
|
||||
|
||||
> foo
|
||||
- bar
|
||||
|
||||
<blockquote>
|
||||
<p>foo
|
||||
- bar</p>
|
||||
</blockquote>
|
||||
|
||||
### Example 202
|
||||
|
||||
A block quote can be empty:
|
||||
|
||||
>
|
||||
|
||||
### Example 203
|
||||
|
||||
>
|
||||
>
|
||||
>
|
||||
|
||||
### Example 204
|
||||
|
||||
A block quote can have initial or final blank lines:
|
||||
|
||||
>
|
||||
> foo
|
||||
>
|
||||
|
||||
### Example 205
|
||||
|
||||
A blank line always separates block quotes:
|
||||
|
||||
> foo
|
||||
|
||||
> bar
|
||||
|
||||
### Example 206
|
||||
|
||||
Consecutiveness means that if we put these block quotes together, we get a single block quote:
|
||||
|
||||
> foo
|
||||
> bar
|
||||
|
||||
### Example 207
|
||||
|
||||
To get a block quote with two paragraphs, use:
|
||||
|
||||
> foo
|
||||
>
|
||||
> bar
|
||||
|
||||
### Example 208
|
||||
|
||||
Block quotes can interrupt paragraphs:
|
||||
|
||||
foo
|
||||
> bar
|
||||
|
||||
### Example 209
|
||||
|
||||
In general, blank lines are not needed before or after block quotes:
|
||||
|
||||
> aaa
|
||||
***
|
||||
> bbb
|
||||
|
||||
### Example 210
|
||||
|
||||
However, because of laziness, a blank line is needed between a block quote and a following paragraph:
|
||||
|
||||
> bar
|
||||
baz
|
||||
|
||||
### Example 211
|
||||
|
||||
> bar
|
||||
|
||||
baz
|
||||
|
||||
### Example 212
|
||||
|
||||
> bar
|
||||
>
|
||||
baz
|
||||
|
||||
### Example 213
|
||||
|
||||
It is a consequence of the Laziness rule that any number of initial `>`s may be omitted on a continuation line of a nested block quote:
|
||||
|
||||
> > > foo
|
||||
bar
|
||||
|
||||
### Example 214
|
||||
|
||||
>>> foo
|
||||
> bar
|
||||
>>baz
|
||||
|
||||
### Example 215
|
||||
|
||||
When including an indented code block in a block quote, remember that the block quote marker includes both the `>` and a following space. So five spaces are needed after the `>`:
|
||||
|
||||
> code
|
||||
|
||||
> not code
|
300
test/new/cm_html_blocks.html
Normal file
300
test/new/cm_html_blocks.html
Normal file
@ -0,0 +1,300 @@
|
||||
<h1 id="html-blocks">HTML blocks</h1>
|
||||
|
||||
<h3 id="example-116">Example 116</h3>
|
||||
|
||||
<table><tr><td>
|
||||
<pre>
|
||||
**Hello**,
|
||||
<p><em>world</em>.
|
||||
</pre></p>
|
||||
</td></tr></table>
|
||||
|
||||
<h3 id="example-117">Example 117</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
hi
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>okay.</p>
|
||||
|
||||
<h3 id="example-118">Example 118</h3>
|
||||
|
||||
<div>
|
||||
*hello*
|
||||
<foo><a>
|
||||
|
||||
<h3 id="example-119">Example 119</h3>
|
||||
|
||||
</div>
|
||||
*foo*
|
||||
|
||||
<h3 id="example-120">Example 120</h3>
|
||||
|
||||
<DIV CLASS="foo">
|
||||
<p><em>Markdown</em></p>
|
||||
</DIV>
|
||||
|
||||
<h3 id="example-121">Example 121</h3>
|
||||
|
||||
<div id="foo"
|
||||
class="bar">
|
||||
</div>
|
||||
|
||||
<h3 id="example-122">Example 122</h3>
|
||||
|
||||
<div id="foo" class="bar
|
||||
baz">
|
||||
</div>
|
||||
|
||||
<h3 id="example-123">Example 123</h3>
|
||||
|
||||
<div>
|
||||
*foo*
|
||||
<p><em>bar</em></p>
|
||||
|
||||
<h3 id="example-124">Example 124</h3>
|
||||
|
||||
<div id="foo"
|
||||
*hi*
|
||||
|
||||
<h3 id="example-125">Example 125</h3>
|
||||
|
||||
<div class
|
||||
foo
|
||||
|
||||
<h3 id="example-126">Example 126</h3>
|
||||
|
||||
<div *???-&&&-<---
|
||||
*foo*
|
||||
|
||||
<h3 id="example-127">Example 127</h3>
|
||||
|
||||
<div><a href="bar">*foo*</a></div>
|
||||
|
||||
<h3 id="example-128">Example 128</h3>
|
||||
|
||||
<table><tr><td>
|
||||
foo
|
||||
</td></tr></table>
|
||||
|
||||
<h3 id="example-129">Example 129</h3>
|
||||
|
||||
<div></div>
|
||||
``` c
|
||||
int x = 33;
|
||||
```
|
||||
|
||||
<h3 id="example-130">Example 130</h3>
|
||||
|
||||
<a href="foo">
|
||||
*bar*
|
||||
</a>
|
||||
|
||||
<h3 id="example-131">Example 131</h3>
|
||||
|
||||
<Warning>
|
||||
*bar*
|
||||
</Warning>
|
||||
|
||||
<h3 id="example-132">Example 132</h3>
|
||||
|
||||
<i class="foo">
|
||||
*bar*
|
||||
</i>
|
||||
|
||||
<h3 id="example-133">Example 133</h3>
|
||||
|
||||
</ins>
|
||||
*bar*
|
||||
|
||||
<h3 id="example-134">Example 134</h3>
|
||||
|
||||
<del>
|
||||
*foo*
|
||||
</del>
|
||||
|
||||
<h3 id="example-135">Example 135</h3>
|
||||
|
||||
<del>
|
||||
<p><em>foo</em></p>
|
||||
</del>
|
||||
|
||||
<h3 id="example-136">Example 136</h3>
|
||||
|
||||
<p><del><em>foo</em></del></p>
|
||||
|
||||
<h3 id="example-137">Example 137</h3>
|
||||
|
||||
<pre language="haskell"><code>
|
||||
import Text.HTML.TagSoup
|
||||
|
||||
main :: IO ()
|
||||
main = print $ parseTags tags
|
||||
</code></pre>
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-138">Example 138</h3>
|
||||
|
||||
<script type="text/javascript">
|
||||
// JavaScript example
|
||||
|
||||
document.getElementById("demo").innerHTML = "Hello JavaScript!";
|
||||
</script>
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-139">Example 139</h3>
|
||||
|
||||
<style
|
||||
type="text/css">
|
||||
h1 {color:red;}
|
||||
|
||||
p {color:blue;}
|
||||
</style>
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-141">Example 141</h3>
|
||||
|
||||
<blockquote>
|
||||
<div>
|
||||
foo
|
||||
</blockquote>
|
||||
<p>bar</p>
|
||||
|
||||
<h3 id="example-142">Example 142</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<div>
|
||||
</li>
|
||||
<li>foo</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="example-143">Example 143</h3>
|
||||
|
||||
<style>p{color:red;}</style>
|
||||
<p><em>foo</em></p>
|
||||
|
||||
<h3 id="example-144">Example 144</h3>
|
||||
|
||||
<!-- foo -->*bar*
|
||||
<p><em>baz</em></p>
|
||||
|
||||
<h3 id="example-145">Example 145</h3>
|
||||
|
||||
<script>
|
||||
foo
|
||||
</script>1. *bar*
|
||||
|
||||
<h3 id="example-146">Example 146</h3>
|
||||
|
||||
<!-- Foo
|
||||
|
||||
bar
|
||||
baz -->
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-147">Example 147</h3>
|
||||
|
||||
<?php
|
||||
|
||||
echo '>';
|
||||
|
||||
?>
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-148">Example 148</h3>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<h3 id="example-149">Example 149</h3>
|
||||
|
||||
<![CDATA[
|
||||
function matchwo(a,b)
|
||||
{
|
||||
if (a < b && a < 0) then {
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
<p>okay</p>
|
||||
|
||||
<h3 id="example-150">Example 150</h3>
|
||||
|
||||
<!-- foo -->
|
||||
<pre><code><!-- foo -->
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-151">Example 151</h3>
|
||||
|
||||
<div>
|
||||
<pre><code><div>
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-152">Example 152</h3>
|
||||
|
||||
<p>Foo</p>
|
||||
<div>
|
||||
bar
|
||||
</div>
|
||||
|
||||
<h3 id="example-153">Example 153</h3>
|
||||
|
||||
<div>
|
||||
bar
|
||||
</div>
|
||||
*foo*
|
||||
|
||||
<h3 id="example-154">Example 154</h3>
|
||||
|
||||
<p>Foo
|
||||
<a href="bar">
|
||||
baz</p>
|
||||
|
||||
<h3 id="example-155">Example 155</h3>
|
||||
|
||||
<div>
|
||||
<p><em>Emphasized</em> text.</p>
|
||||
</div>
|
||||
|
||||
<h3 id="example-156">Example 156</h3>
|
||||
|
||||
<div>
|
||||
*Emphasized* text.
|
||||
</div>
|
||||
|
||||
<h3 id="example-157">Example 157</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Hi
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3 id="example-158">Example 158</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<pre><code><td>
|
||||
Hi
|
||||
</td>
|
||||
</code></pre>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3 id="example-140">Example 140</h3>
|
||||
|
||||
<p>If there is no matching end tag, the block will end at the end of the document (or the enclosing block quote or list item):</p>
|
||||
|
||||
<style
|
||||
type="text/css">
|
||||
|
||||
foo
|
312
test/new/cm_html_blocks.md
Normal file
312
test/new/cm_html_blocks.md
Normal file
@ -0,0 +1,312 @@
|
||||
HTML blocks
|
||||
===================
|
||||
|
||||
### Example 116
|
||||
|
||||
<table><tr><td>
|
||||
<pre>
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
|
||||
### Example 117
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
hi
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
okay.
|
||||
|
||||
### Example 118
|
||||
|
||||
<div>
|
||||
*hello*
|
||||
<foo><a>
|
||||
|
||||
### Example 119
|
||||
|
||||
</div>
|
||||
*foo*
|
||||
|
||||
### Example 120
|
||||
|
||||
<DIV CLASS="foo">
|
||||
|
||||
*Markdown*
|
||||
|
||||
</DIV>
|
||||
|
||||
### Example 121
|
||||
|
||||
<div id="foo"
|
||||
class="bar">
|
||||
</div>
|
||||
|
||||
### Example 122
|
||||
|
||||
<div id="foo" class="bar
|
||||
baz">
|
||||
</div>
|
||||
|
||||
### Example 123
|
||||
|
||||
<div>
|
||||
*foo*
|
||||
|
||||
*bar*
|
||||
|
||||
### Example 124
|
||||
|
||||
<div id="foo"
|
||||
*hi*
|
||||
|
||||
### Example 125
|
||||
|
||||
<div class
|
||||
foo
|
||||
|
||||
### Example 126
|
||||
|
||||
<div *???-&&&-<---
|
||||
*foo*
|
||||
|
||||
### Example 127
|
||||
|
||||
<div><a href="bar">*foo*</a></div>
|
||||
|
||||
### Example 128
|
||||
|
||||
<table><tr><td>
|
||||
foo
|
||||
</td></tr></table>
|
||||
|
||||
### Example 129
|
||||
|
||||
<div></div>
|
||||
``` c
|
||||
int x = 33;
|
||||
```
|
||||
|
||||
### Example 130
|
||||
|
||||
<a href="foo">
|
||||
*bar*
|
||||
</a>
|
||||
|
||||
### Example 131
|
||||
|
||||
<Warning>
|
||||
*bar*
|
||||
</Warning>
|
||||
|
||||
### Example 132
|
||||
|
||||
<i class="foo">
|
||||
*bar*
|
||||
</i>
|
||||
|
||||
### Example 133
|
||||
|
||||
</ins>
|
||||
*bar*
|
||||
|
||||
### Example 134
|
||||
|
||||
<del>
|
||||
*foo*
|
||||
</del>
|
||||
|
||||
### Example 135
|
||||
|
||||
<del>
|
||||
|
||||
*foo*
|
||||
|
||||
</del>
|
||||
|
||||
### Example 136
|
||||
|
||||
<del>*foo*</del>
|
||||
|
||||
### Example 137
|
||||
|
||||
<pre language="haskell"><code>
|
||||
import Text.HTML.TagSoup
|
||||
|
||||
main :: IO ()
|
||||
main = print $ parseTags tags
|
||||
</code></pre>
|
||||
okay
|
||||
|
||||
### Example 138
|
||||
|
||||
<script type="text/javascript">
|
||||
// JavaScript example
|
||||
|
||||
document.getElementById("demo").innerHTML = "Hello JavaScript!";
|
||||
</script>
|
||||
okay
|
||||
|
||||
### Example 139
|
||||
|
||||
<style
|
||||
type="text/css">
|
||||
h1 {color:red;}
|
||||
|
||||
p {color:blue;}
|
||||
</style>
|
||||
okay
|
||||
|
||||
### Example 141
|
||||
|
||||
> <div>
|
||||
> foo
|
||||
|
||||
bar
|
||||
|
||||
### Example 142
|
||||
|
||||
- <div>
|
||||
- foo
|
||||
|
||||
### Example 143
|
||||
|
||||
<style>p{color:red;}</style>
|
||||
*foo*
|
||||
|
||||
### Example 144
|
||||
|
||||
<!-- foo -->*bar*
|
||||
*baz*
|
||||
|
||||
### Example 145
|
||||
|
||||
<script>
|
||||
foo
|
||||
</script>1. *bar*
|
||||
|
||||
### Example 146
|
||||
|
||||
<!-- Foo
|
||||
|
||||
bar
|
||||
baz -->
|
||||
okay
|
||||
|
||||
### Example 147
|
||||
|
||||
<?php
|
||||
|
||||
echo '>';
|
||||
|
||||
?>
|
||||
okay
|
||||
|
||||
### Example 148
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
### Example 149
|
||||
|
||||
<![CDATA[
|
||||
function matchwo(a,b)
|
||||
{
|
||||
if (a < b && a < 0) then {
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
okay
|
||||
|
||||
### Example 150
|
||||
|
||||
<!-- foo -->
|
||||
|
||||
<!-- foo -->
|
||||
|
||||
### Example 151
|
||||
|
||||
<div>
|
||||
|
||||
<div>
|
||||
|
||||
### Example 152
|
||||
|
||||
Foo
|
||||
<div>
|
||||
bar
|
||||
</div>
|
||||
|
||||
### Example 153
|
||||
|
||||
<div>
|
||||
bar
|
||||
</div>
|
||||
*foo*
|
||||
|
||||
### Example 154
|
||||
|
||||
Foo
|
||||
<a href="bar">
|
||||
baz
|
||||
|
||||
### Example 155
|
||||
|
||||
<div>
|
||||
|
||||
*Emphasized* text.
|
||||
|
||||
</div>
|
||||
|
||||
### Example 156
|
||||
|
||||
<div>
|
||||
*Emphasized* text.
|
||||
</div>
|
||||
|
||||
### Example 157
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
Hi
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
### Example 158
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
Hi
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
### Example 140
|
||||
|
||||
If there is no matching end tag, the block will end at the end of the document (or the enclosing block quote or list item):
|
||||
|
||||
<style
|
||||
type="text/css">
|
||||
|
||||
foo
|
115
test/new/cm_link_defs.html
Normal file
115
test/new/cm_link_defs.html
Normal file
@ -0,0 +1,115 @@
|
||||
<h3 id="example-159">Example 159</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo159</a></p>
|
||||
|
||||
<h3 id="example-160">Example 160</h3>
|
||||
|
||||
<p><a href="/url" title="the title">foo160</a></p>
|
||||
|
||||
<h3 id="example-161">Example 161</h3>
|
||||
|
||||
<p><a href="my_(url)" title="title (with parens)">Foo161*bar]</a></p>
|
||||
|
||||
<h3 id="example-162">Example 162</h3>
|
||||
|
||||
<p><a href="my%20url" title="title">Foo162 bar</a></p>
|
||||
|
||||
<h3 id="example-163">Example 163</h3>
|
||||
|
||||
<p><a href="/url" title="
|
||||
title
|
||||
line1
|
||||
line2
|
||||
">foo163</a></p>
|
||||
|
||||
<h3 id="example-164">Example 164</h3>
|
||||
|
||||
<p>[foo164]: /url 'title</p>
|
||||
<p>with blank line'</p>
|
||||
<p>[foo164]</p>
|
||||
|
||||
<h3 id="example-165">Example 165</h3>
|
||||
|
||||
<p><a href="/url">foo165</a></p>
|
||||
|
||||
<h3 id="example-166">Example 166</h3>
|
||||
|
||||
<p>[foo166]:</p>
|
||||
<p>[foo166]</p>
|
||||
|
||||
<h3 id="example-167">Example 167</h3>
|
||||
|
||||
<pre><code>[foo167]: /url\bar\*baz "foo\"bar\baz"
|
||||
|
||||
[foo167]
|
||||
|
||||
should render to
|
||||
|
||||
<p><a href="/url%5Cbar*baz" title="foo&quot;bar\baz">foo167</a></p></code></pre>
|
||||
|
||||
<h3 id="example-168">Example 168</h3>
|
||||
|
||||
<p><a href="url">foo168</a></p>
|
||||
|
||||
<h3 id="example-169">Example 169</h3>
|
||||
|
||||
<p><a href="first">foo169</a></p>
|
||||
|
||||
<h3 id="example-170">Example 170</h3>
|
||||
|
||||
<p><a href="/url">Foo170</a></p>
|
||||
|
||||
<h3 id="example-171">Example 171</h3>
|
||||
|
||||
<p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p>
|
||||
|
||||
<h3 id="example-172">Example 172</h3>
|
||||
|
||||
<h3 id="example-173">Example 173</h3>
|
||||
|
||||
<p>bar</p>
|
||||
|
||||
<h3 id="example-174">Example 174</h3>
|
||||
|
||||
<p>[foo174]: /url "title" ok</p>
|
||||
|
||||
<h3 id="example-175">Example 175</h3>
|
||||
|
||||
<p>"title" ok</p>
|
||||
|
||||
<h3 id="example-176">Example 176</h3>
|
||||
|
||||
<pre><code>[foo176]: /url "title"
|
||||
</code></pre>
|
||||
<p>[foo176]</p>
|
||||
|
||||
<h3 id="example-177">Example 177</h3>
|
||||
|
||||
<pre><code>[foo177]: /url
|
||||
</code></pre>
|
||||
<p>[foo177]</p>
|
||||
|
||||
<h3 id="example-178">Example 178</h3>
|
||||
|
||||
<p>Foo
|
||||
[bar178]: /baz</p>
|
||||
<p>[bar178]</p>
|
||||
|
||||
<h3 id="example-179">Example 179</h3>
|
||||
|
||||
<h1 id="foo179"><a href="/url">Foo179</a></h1>
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
|
||||
<h3 id="example-180">Example 180</h3>
|
||||
|
||||
<p><a href="/foo-url" title="foo">foo180</a>,
|
||||
<a href="/bar-url" title="bar">bar180</a>,
|
||||
<a href="/baz-url">baz180</a></p>
|
||||
|
||||
<h3 id="example-181">Example 181</h3>
|
||||
|
||||
<p><a href="/url">foo181</a></p>
|
||||
<blockquote>
|
||||
</blockquote>
|
157
test/new/cm_link_defs.md
Normal file
157
test/new/cm_link_defs.md
Normal file
@ -0,0 +1,157 @@
|
||||
### Example 159
|
||||
|
||||
[foo159]: /url "title"
|
||||
|
||||
[foo159]
|
||||
|
||||
### Example 160
|
||||
|
||||
[foo160]:
|
||||
/url
|
||||
'the title'
|
||||
|
||||
[foo160]
|
||||
|
||||
### Example 161
|
||||
|
||||
[Foo161*bar\]]:my_(url) 'title (with parens)'
|
||||
|
||||
[Foo161*bar\]]
|
||||
|
||||
### Example 162
|
||||
|
||||
[Foo162 bar]:
|
||||
<my%20url>
|
||||
'title'
|
||||
|
||||
[Foo162 bar]
|
||||
|
||||
### Example 163
|
||||
|
||||
[foo163]: /url '
|
||||
title
|
||||
line1
|
||||
line2
|
||||
'
|
||||
|
||||
[foo163]
|
||||
|
||||
### Example 164
|
||||
|
||||
[foo164]: /url 'title
|
||||
|
||||
with blank line'
|
||||
|
||||
[foo164]
|
||||
|
||||
### Example 165
|
||||
|
||||
[foo165]:
|
||||
/url
|
||||
|
||||
[foo165]
|
||||
|
||||
### Example 166
|
||||
|
||||
[foo166]:
|
||||
|
||||
[foo166]
|
||||
|
||||
### Example 167
|
||||
|
||||
[foo167]: /url\bar\*baz "foo\"bar\baz"
|
||||
|
||||
[foo167]
|
||||
|
||||
should render to
|
||||
|
||||
<p><a href="/url%5Cbar*baz" title="foo"bar\baz">foo167</a></p>
|
||||
|
||||
### Example 168
|
||||
|
||||
[foo168]
|
||||
|
||||
[foo168]: url
|
||||
|
||||
### Example 169
|
||||
|
||||
[foo169]
|
||||
|
||||
[foo169]: first
|
||||
[foo169]: second
|
||||
|
||||
### Example 170
|
||||
|
||||
[FOO170]: /url
|
||||
|
||||
[Foo170]
|
||||
|
||||
### Example 171
|
||||
|
||||
[ΑΓΩ]: /φου
|
||||
|
||||
[αγω]
|
||||
|
||||
### Example 172
|
||||
|
||||
[foo172]: /url
|
||||
|
||||
### Example 173
|
||||
|
||||
[
|
||||
foo173
|
||||
]: /url
|
||||
bar
|
||||
|
||||
### Example 174
|
||||
|
||||
[foo174]: /url "title" ok
|
||||
|
||||
### Example 175
|
||||
|
||||
[foo175]: /url
|
||||
"title" ok
|
||||
|
||||
### Example 176
|
||||
|
||||
[foo176]: /url "title"
|
||||
|
||||
[foo176]
|
||||
|
||||
### Example 177
|
||||
|
||||
```
|
||||
[foo177]: /url
|
||||
```
|
||||
|
||||
[foo177]
|
||||
|
||||
### Example 178
|
||||
|
||||
Foo
|
||||
[bar178]: /baz
|
||||
|
||||
[bar178]
|
||||
|
||||
### Example 179
|
||||
|
||||
# [Foo179]
|
||||
[foo179]: /url
|
||||
> bar
|
||||
|
||||
### Example 180
|
||||
|
||||
[foo180]: /foo-url "foo"
|
||||
[bar180]: /bar-url
|
||||
"bar"
|
||||
[baz180]: /baz-url
|
||||
|
||||
[foo180],
|
||||
[bar180],
|
||||
[baz180]
|
||||
|
||||
### Example 181
|
||||
|
||||
[foo181]
|
||||
|
||||
> [foo181]: /url
|
397
test/new/cm_links.html
Normal file
397
test/new/cm_links.html
Normal file
@ -0,0 +1,397 @@
|
||||
<h1 id="links">Links</h1>
|
||||
|
||||
<h3 id="example-459">Example 459</h3>
|
||||
|
||||
<p><a href="/uri" title="title">link</a></p>
|
||||
|
||||
<h3 id="example-460">Example 460</h3>
|
||||
|
||||
<p><a href="/uri">link</a></p>
|
||||
|
||||
<h3 id="example-461">Example 461</h3>
|
||||
|
||||
<p><a href="">link</a></p>
|
||||
|
||||
<h3 id="example-462">Example 462</h3>
|
||||
|
||||
<p><a href="">link</a></p>
|
||||
|
||||
<h3 id="example-463">Example 463</h3>
|
||||
|
||||
<p>[link](/my uri)</p>
|
||||
|
||||
<h3 id="example-464">Example 464</h3>
|
||||
|
||||
<p>[link](</my uri>)</p>
|
||||
|
||||
<h3 id="example-465">Example 465</h3>
|
||||
|
||||
<p>[link](foo
|
||||
bar)</p>
|
||||
|
||||
<h3 id="example-466">Example 466</h3>
|
||||
|
||||
<p>[link](<foo
|
||||
bar>)</p>
|
||||
|
||||
<h3 id="example-467">Example 467</h3>
|
||||
|
||||
<p><a href="(foo)">link</a></p>
|
||||
|
||||
<h3 id="example-4680">Example 4680</h3>
|
||||
|
||||
<p>ONE LEVEL of parentheses are allowed without escaping, as long as they are balanced:</p>
|
||||
|
||||
<p><a href="foo(bar)">link</a></p>
|
||||
|
||||
<h3 id="example-469">Example 469</h3>
|
||||
|
||||
<p><a href="foo(and(bar)">link</a></p>
|
||||
|
||||
<h3 id="example-470">Example 470</h3>
|
||||
|
||||
<p>However, if you have ANY unbalanced parentheses, you need to escape or use the <...> form:</p>
|
||||
|
||||
<p><a href="foo(and(bar)">link</a></p>
|
||||
|
||||
<h3 id="example-471">Example 471</h3>
|
||||
|
||||
<p><a href="foo):">link</a></p>
|
||||
|
||||
<h3 id="example-472">Example 472</h3>
|
||||
|
||||
<p><a href="#fragment">link</a></p>
|
||||
<p><a href="http://example.com#fragment">link</a></p>
|
||||
<p><a href="http://example.com?foo=3#frag">link</a></p>
|
||||
|
||||
<h3 id="example-473">Example 473</h3>
|
||||
|
||||
<p><a href="foo%5Cbar">link</a></p>
|
||||
|
||||
<h3 id="example-4740">Example 4740</h3>
|
||||
|
||||
<p><a href="foo%20bä">link</a></p>
|
||||
|
||||
<h3 id="example-475">Example 475</h3>
|
||||
|
||||
<p><a href="%22title%22">link</a></p>
|
||||
|
||||
<h3 id="example-476">Example 476</h3>
|
||||
|
||||
<p><a href="/url" title="title">link</a>
|
||||
<a href="/url" title="title">link</a>
|
||||
<a href="/url" title="title">link</a></p>
|
||||
|
||||
<h3 id="example-477">Example 477</h3>
|
||||
|
||||
<p><a href="/url" title="title """>link</a></p>
|
||||
|
||||
<h3 id="example-479">Example 479</h3>
|
||||
|
||||
<p>[link](/url "title "and" title")</p>
|
||||
|
||||
<h3 id="example-480">Example 480</h3>
|
||||
|
||||
<p><a href="/url" title="title "and" title">link</a></p>
|
||||
|
||||
<h3 id="example-481">Example 481</h3>
|
||||
|
||||
<p><a href="/uri" title="title">link</a></p>
|
||||
|
||||
<h3 id="example-482">Example 482</h3>
|
||||
|
||||
<p>[link] (/uri)</p>
|
||||
|
||||
<h3 id="example-4830">Example 4830</h3>
|
||||
|
||||
<p>The link text may contain ONE LEVEL of balanced brackets, but not unbalanced ones, unless they are escaped:</p>
|
||||
|
||||
<p><a href="/uri">link [foo4830]</a></p>
|
||||
|
||||
<h3 id="example-484">Example 484</h3>
|
||||
|
||||
<p>[link] bar](/uri)</p>
|
||||
|
||||
<h3 id="example-485">Example 485</h3>
|
||||
|
||||
<p>[link <a href="/uri">bar</a></p>
|
||||
|
||||
<h3 id="example-486">Example 486</h3>
|
||||
|
||||
<p><a href="/uri">link [bar</a></p>
|
||||
|
||||
<h3 id="example-487">Example 487</h3>
|
||||
|
||||
<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>
|
||||
|
||||
<h3 id="example-488">Example 488</h3>
|
||||
|
||||
<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>
|
||||
|
||||
<h3 id="example-493">Example 493</h3>
|
||||
|
||||
<p><a href="baz*">foo *bar</a></p>
|
||||
|
||||
<h3 id="example-494">Example 494</h3>
|
||||
|
||||
<p><em>foo [bar</em> baz]</p>
|
||||
|
||||
<h3 id="example-498">Example 498</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo</a></p>
|
||||
|
||||
<h3 id="example-4990">Example 4990</h3>
|
||||
|
||||
<p><a href="/uri">link [foo499]</a></p>
|
||||
|
||||
<h3 id="example-500">Example 500</h3>
|
||||
|
||||
<p><a href="/uri">link [bar</a></p>
|
||||
|
||||
<h3 id="example-501">Example 501</h3>
|
||||
|
||||
<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>
|
||||
|
||||
<h3 id="example-502">Example 502</h3>
|
||||
|
||||
<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>
|
||||
|
||||
<h3 id="example-5030">Example 5030</h3>
|
||||
|
||||
<p><a href="/uri">foo <a href="/uri">bar</a></a></p>
|
||||
|
||||
<h3 id="example-504">Example 504</h3>
|
||||
|
||||
<p><a href="/uri">foo <em>bar <a href="/uri">baz</a></em></a></p>
|
||||
|
||||
<h3 id="example-506">Example 506</h3>
|
||||
|
||||
<p><a href="/uri">foo *bar</a></p>
|
||||
|
||||
<h3 id="example-510">Example 510</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo</a></p>
|
||||
|
||||
<h3 id="example-511">Example 511</h3>
|
||||
|
||||
<p><a href="/url">Толпой</a> is a Russian word.</p>
|
||||
|
||||
<h3 id="example-512">Example 512</h3>
|
||||
|
||||
<p><a href="/url">Baz</a></p>
|
||||
|
||||
<h3 id="example-513">Example 513</h3>
|
||||
|
||||
<p>[foo513] <a href="/url" title="title">bar513</a></p>
|
||||
|
||||
<h3 id="example-514">Example 514</h3>
|
||||
|
||||
<p>[foo514]
|
||||
<a href="/url" title="title">bar514</a></p>
|
||||
|
||||
<h3 id="example-515">Example 515</h3>
|
||||
|
||||
<p><a href="/url1">bar</a></p>
|
||||
|
||||
<h3 id="example-516">Example 516</h3>
|
||||
|
||||
<p>[bar][foo!516]</p>
|
||||
|
||||
<h3 id="example-517">Example 517</h3>
|
||||
|
||||
<p>[foo517][ref[517]</p>
|
||||
<p>[ref[517]: /uri</p>
|
||||
|
||||
<h3 id="example-518">Example 518</h3>
|
||||
|
||||
<p>[foo518][ref[bar518]518]</p>
|
||||
<p>[ref[bar518]518]: /uri</p>
|
||||
|
||||
<h3 id="example-519">Example 519</h3>
|
||||
|
||||
<p>[[[foo519]]]</p>
|
||||
<p>[[[foo519]]]: /url</p>
|
||||
|
||||
<h3 id="example-520">Example 520</h3>
|
||||
|
||||
<p><a href="/uri">foo</a></p>
|
||||
|
||||
<h3 id="example-521">Example 521</h3>
|
||||
|
||||
<p><a href="/uri">bar\</a></p>
|
||||
|
||||
<h3 id="example-522">Example 522</h3>
|
||||
|
||||
<p>[]</p>
|
||||
<p>[]: /uri</p>
|
||||
|
||||
<h3 id="example-523">Example 523</h3>
|
||||
|
||||
<p>[
|
||||
]</p>
|
||||
<p>[
|
||||
]: /uri</p>
|
||||
|
||||
<h3 id="example-524">Example 524</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo</a></p>
|
||||
|
||||
<h3 id="example-525">Example 525</h3>
|
||||
|
||||
<p><a href="/url" title="title"><em>foo</em> bar</a></p>
|
||||
|
||||
<h3 id="example-526">Example 526</h3>
|
||||
|
||||
<p><a href="/url" title="title">Foo</a></p>
|
||||
|
||||
<h3 id="example-527">Example 527</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo</a>
|
||||
[]</p>
|
||||
|
||||
<h3 id="example-528">Example 528</h3>
|
||||
|
||||
<p><a href="/url" title="title">foo</a></p>
|
||||
|
||||
<h3 id="example-529">Example 529</h3>
|
||||
|
||||
<p><a href="/url" title="title"><em>foo</em> bar</a></p>
|
||||
|
||||
<h3 id="example-530">Example 530</h3>
|
||||
|
||||
<p>[<a href="/url" title="title"><em>foo</em> bar</a>]</p>
|
||||
|
||||
<h3 id="example-531">Example 531</h3>
|
||||
|
||||
<p>[[bar <a href="/url">foo531</a></p>
|
||||
|
||||
<h3 id="example-532">Example 532</h3>
|
||||
|
||||
<p><a href="/url" title="title">Foo</a></p>
|
||||
|
||||
<h3 id="example-533">Example 533</h3>
|
||||
|
||||
<p><a href="/url">foo533</a> bar</p>
|
||||
|
||||
<h3 id="example-534">Example 534</h3>
|
||||
|
||||
<p>[foo]</p>
|
||||
|
||||
<h3 id="example-536">Example 536</h3>
|
||||
|
||||
<p><a href="/url2">foo536</a></p>
|
||||
|
||||
<h3 id="example-537">Example 537</h3>
|
||||
|
||||
<p><a href="/url1">foo537</a></p>
|
||||
|
||||
<h3 id="example-538">Example 538</h3>
|
||||
|
||||
<p><a href="">foo538</a></p>
|
||||
|
||||
<h3 id="example-539">Example 539</h3>
|
||||
|
||||
<p><a href="/url1">foo539</a>(not a link)</p>
|
||||
|
||||
<h3 id="example-540">Example 540</h3>
|
||||
|
||||
<p>[foo540]<a href="/url">bar540</a></p>
|
||||
|
||||
<h3 id="example-541">Example 541</h3>
|
||||
|
||||
<p><a href="/url2">foo541</a><a href="/url1">baz541</a></p>
|
||||
|
||||
<h3 id="example-542">Example 542</h3>
|
||||
|
||||
<p>[foo542]<a href="/url1">bar542</a></p>
|
||||
|
||||
<h3 id="example-543">Example 543</h3>
|
||||
|
||||
<p><img src="/url" alt="foo543" title="title" /></p>
|
||||
|
||||
<h3 id="example-5440">Example 5440</h3>
|
||||
|
||||
<p><img src="train.jpg" alt="foo *bar*544" title="train & tracks" /></p>
|
||||
|
||||
<h3 id="example-5450">Example 5450</h3>
|
||||
|
||||
<p><img src="/url2" alt="foo " /></p>
|
||||
|
||||
<h3 id="example-5460">Example 5460</h3>
|
||||
|
||||
<p><img src="/url2" alt="foo [bar](/url)" /></p>
|
||||
|
||||
<h3 id="example-5470">Example 5470</h3>
|
||||
|
||||
<p><img src="train.jpg" alt="foo *bar*547" title="train & tracks" /></p>
|
||||
|
||||
<h3 id="example-5480">Example 5480</h3>
|
||||
|
||||
<p><img src="train.jpg" alt="foo *bar*" title="train & tracks" /></p>
|
||||
|
||||
<h3 id="example-549">Example 549</h3>
|
||||
|
||||
<p><img src="train.jpg" alt="foo" /></p>
|
||||
|
||||
<h3 id="example-550">Example 550</h3>
|
||||
|
||||
<p>My <img src="/path/to/train.jpg" alt="foo bar" title="title" /></p>
|
||||
|
||||
<h3 id="example-551">Example 551</h3>
|
||||
|
||||
<p><img src="url" alt="foo" /></p>
|
||||
|
||||
<h3 id="example-552">Example 552</h3>
|
||||
|
||||
<p><img src="/url" alt="" /></p>
|
||||
|
||||
<h3 id="example-553">Example 553</h3>
|
||||
|
||||
<p><img src="/url" alt="foo" /></p>
|
||||
|
||||
<h3 id="example-554">Example 554</h3>
|
||||
|
||||
<p><img src="/url" alt="foo" /></p>
|
||||
|
||||
<h3 id="example-555">Example 555</h3>
|
||||
|
||||
<p><img src="/url" alt="foo" title="title" /></p>
|
||||
|
||||
<h3 id="example-5560">Example 5560</h3>
|
||||
|
||||
<p><img src="/url" alt="*foo* bar" title="title" /></p>
|
||||
|
||||
<h3 id="example-557">Example 557</h3>
|
||||
|
||||
<p><img src="/url" alt="Foo" title="title" /></p>
|
||||
|
||||
<h3 id="example-558">Example 558</h3>
|
||||
|
||||
<p><img src="/url" alt="foo" title="title" />
|
||||
[]</p>
|
||||
|
||||
<h3 id="example-559">Example 559</h3>
|
||||
|
||||
<p><img src="/url" alt="foo" title="title" /></p>
|
||||
|
||||
<h3 id="example-5600">Example 5600</h3>
|
||||
|
||||
<p><img src="/url" alt="*foo* bar" title="title" /></p>
|
||||
|
||||
<h3 id="example-561">Example 561</h3>
|
||||
|
||||
<p>![[foo561]]</p>
|
||||
<p>[[foo561]]: /url "title"</p>
|
||||
|
||||
<h3 id="example-562">Example 562</h3>
|
||||
|
||||
<p><img src="/url" alt="Foo" title="title" /></p>
|
||||
|
||||
<h3 id="example-563">Example 563</h3>
|
||||
|
||||
<p>![foo]</p>
|
||||
|
||||
<h3 id="example-564">Example 564</h3>
|
||||
|
||||
<p>!<a href="/url" title="title">foo</a></p>
|
||||
|
515
test/new/cm_links.md
Normal file
515
test/new/cm_links.md
Normal file
@ -0,0 +1,515 @@
|
||||
---
|
||||
xhtml: true
|
||||
---
|
||||
|
||||
Links
|
||||
===================
|
||||
|
||||
### Example 459
|
||||
|
||||
[link](/uri "title")
|
||||
|
||||
### Example 460
|
||||
|
||||
[link](/uri)
|
||||
|
||||
### Example 461
|
||||
|
||||
[link]()
|
||||
|
||||
### Example 462
|
||||
|
||||
[link](<>)
|
||||
|
||||
### Example 463
|
||||
|
||||
[link](/my uri)
|
||||
|
||||
### Example 464
|
||||
|
||||
[link](</my uri>)
|
||||
|
||||
### Example 465
|
||||
|
||||
[link](foo
|
||||
bar)
|
||||
|
||||
### Example 466
|
||||
|
||||
[link](<foo
|
||||
bar>)
|
||||
|
||||
### Example 467
|
||||
|
||||
[link](\(foo\))
|
||||
|
||||
### Example 4680
|
||||
|
||||
ONE LEVEL of parentheses are allowed without escaping, as long as they are balanced:
|
||||
|
||||
[link](foo(bar))
|
||||
|
||||
### Example 469
|
||||
|
||||
[link](foo\(and\(bar\))
|
||||
|
||||
### Example 470
|
||||
|
||||
However, if you have ANY unbalanced parentheses, you need to escape or use the <...> form:
|
||||
|
||||
[link](<foo(and(bar)>)
|
||||
|
||||
### Example 471
|
||||
|
||||
[link](foo\)\:)
|
||||
|
||||
### Example 472
|
||||
|
||||
[link](#fragment)
|
||||
|
||||
[link](http://example.com#fragment)
|
||||
|
||||
[link](http://example.com?foo=3#frag)
|
||||
|
||||
### Example 473
|
||||
|
||||
[link](foo\bar)
|
||||
|
||||
### Example 4740
|
||||
|
||||
[link](foo%20bä)
|
||||
|
||||
### Example 475
|
||||
|
||||
[link]("title")
|
||||
|
||||
### Example 476
|
||||
|
||||
[link](/url "title")
|
||||
[link](/url 'title')
|
||||
[link](/url (title))
|
||||
|
||||
### Example 477
|
||||
|
||||
[link](/url "title \""")
|
||||
|
||||
### Example 479
|
||||
|
||||
[link](/url "title "and" title")
|
||||
|
||||
### Example 480
|
||||
|
||||
[link](/url 'title "and" title')
|
||||
|
||||
### Example 481
|
||||
|
||||
[link]( /uri
|
||||
"title" )
|
||||
|
||||
### Example 482
|
||||
|
||||
[link] (/uri)
|
||||
|
||||
### Example 4830
|
||||
|
||||
The link text may contain ONE LEVEL of balanced brackets, but not unbalanced ones, unless they are escaped:
|
||||
|
||||
[link [foo4830]](/uri)
|
||||
|
||||
### Example 484
|
||||
|
||||
[link] bar](/uri)
|
||||
|
||||
### Example 485
|
||||
|
||||
[link [bar](/uri)
|
||||
|
||||
### Example 486
|
||||
|
||||
[link \[bar](/uri)
|
||||
|
||||
### Example 487
|
||||
|
||||
[link *foo **bar** `#`*](/uri)
|
||||
|
||||
### Example 488
|
||||
|
||||
[](/uri)
|
||||
|
||||
### Example 493
|
||||
|
||||
[foo *bar](baz*)
|
||||
|
||||
### Example 494
|
||||
|
||||
*foo [bar* baz]
|
||||
|
||||
### Example 498
|
||||
|
||||
[foo][bar]
|
||||
|
||||
[bar]: /url "title"
|
||||
|
||||
### Example 4990
|
||||
|
||||
[link [foo499]][ref499]
|
||||
|
||||
[ref499]: /uri
|
||||
|
||||
### Example 500
|
||||
|
||||
[link \[bar][ref]
|
||||
|
||||
[ref]: /uri
|
||||
|
||||
### Example 501
|
||||
|
||||
[link *foo **bar** `#`*][ref]
|
||||
|
||||
[ref]: /uri
|
||||
|
||||
### Example 502
|
||||
|
||||
[][ref]
|
||||
|
||||
[ref]: /uri
|
||||
|
||||
### Example 5030
|
||||
|
||||
[foo [bar](/uri)][ref503]
|
||||
|
||||
[ref503]: /uri
|
||||
|
||||
### Example 504
|
||||
|
||||
[foo *bar [baz][ref504]*][ref504]
|
||||
|
||||
[ref504]: /uri
|
||||
|
||||
### Example 506
|
||||
|
||||
[foo *bar][ref]
|
||||
|
||||
[ref]: /uri
|
||||
|
||||
### Example 510
|
||||
|
||||
[foo][BaR]
|
||||
|
||||
[bar]: /url "title"
|
||||
|
||||
### Example 511
|
||||
|
||||
[Толпой][Толпой] is a Russian word.
|
||||
|
||||
[ТОЛПОЙ]: /url
|
||||
|
||||
### Example 512
|
||||
|
||||
[Foo
|
||||
bar]: /url
|
||||
|
||||
[Baz][Foo bar]
|
||||
|
||||
### Example 513
|
||||
|
||||
[foo513] [bar513]
|
||||
|
||||
[bar513]: /url "title"
|
||||
|
||||
### Example 514
|
||||
|
||||
[foo514]
|
||||
[bar514]
|
||||
|
||||
[bar514]: /url "title"
|
||||
|
||||
### Example 515
|
||||
|
||||
[foo515]: /url1
|
||||
|
||||
[foo515]: /url2
|
||||
|
||||
[bar][foo515]
|
||||
|
||||
### Example 516
|
||||
|
||||
[bar][foo\!516]
|
||||
|
||||
[foo!516]: /url
|
||||
|
||||
### Example 517
|
||||
|
||||
[foo517][ref[517]
|
||||
|
||||
[ref[517]: /uri
|
||||
|
||||
### Example 518
|
||||
|
||||
[foo518][ref[bar518]518]
|
||||
|
||||
[ref[bar518]518]: /uri
|
||||
|
||||
### Example 519
|
||||
|
||||
[[[foo519]]]
|
||||
|
||||
[[[foo519]]]: /url
|
||||
|
||||
### Example 520
|
||||
|
||||
[foo][ref\[]
|
||||
|
||||
[ref\[]: /uri
|
||||
|
||||
### Example 521
|
||||
|
||||
[bar\\]: /uri
|
||||
|
||||
[bar\\]
|
||||
|
||||
### Example 522
|
||||
|
||||
[]
|
||||
|
||||
[]: /uri
|
||||
|
||||
### Example 523
|
||||
|
||||
[
|
||||
]
|
||||
|
||||
[
|
||||
]: /uri
|
||||
|
||||
### Example 524
|
||||
|
||||
[foo][]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 525
|
||||
|
||||
[*foo* bar][]
|
||||
|
||||
[*foo* bar]: /url "title"
|
||||
|
||||
### Example 526
|
||||
|
||||
[Foo][]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 527
|
||||
|
||||
[foo]
|
||||
[]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 528
|
||||
|
||||
[foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 529
|
||||
|
||||
[*foo* bar]
|
||||
|
||||
[*foo* bar]: /url "title"
|
||||
|
||||
### Example 530
|
||||
|
||||
[[*foo* bar]]
|
||||
|
||||
[*foo* bar]: /url "title"
|
||||
|
||||
### Example 531
|
||||
|
||||
[[bar [foo531]
|
||||
|
||||
[foo531]: /url
|
||||
|
||||
### Example 532
|
||||
|
||||
[Foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 533
|
||||
|
||||
[foo533] bar
|
||||
|
||||
[foo533]: /url
|
||||
|
||||
### Example 534
|
||||
|
||||
\[foo]
|
||||
|
||||
[foo534]: /url "title"
|
||||
|
||||
### Example 536
|
||||
|
||||
[foo536][bar536]
|
||||
|
||||
[foo536]: /url1
|
||||
[bar536]: /url2
|
||||
|
||||
### Example 537
|
||||
|
||||
[foo537][]
|
||||
|
||||
[foo537]: /url1
|
||||
|
||||
### Example 538
|
||||
|
||||
[foo538]()
|
||||
|
||||
[foo538]: /url1
|
||||
|
||||
### Example 539
|
||||
|
||||
[foo539](not a link)
|
||||
|
||||
[foo539]: /url1
|
||||
|
||||
### Example 540
|
||||
|
||||
[foo540][bar540][baz540]
|
||||
|
||||
[baz540]: /url
|
||||
|
||||
### Example 541
|
||||
|
||||
[foo541][bar541][baz541]
|
||||
|
||||
[baz541]: /url1
|
||||
[bar541]: /url2
|
||||
|
||||
### Example 542
|
||||
|
||||
[foo542][bar542][baz542]
|
||||
|
||||
[baz542]: /url1
|
||||
[foo542]: /url2
|
||||
|
||||
### Example 543
|
||||
|
||||

|
||||
|
||||
### Example 5440
|
||||
|
||||
![foo *bar*544]
|
||||
|
||||
[foo *bar*544]: train.jpg "train & tracks"
|
||||
|
||||
### Example 5450
|
||||
|
||||
](/url2)
|
||||
|
||||
### Example 5460
|
||||
|
||||
](/url2)
|
||||
|
||||
### Example 5470
|
||||
|
||||
![foo *bar*547][]
|
||||
|
||||
[foo *bar*547]: train.jpg "train & tracks"
|
||||
|
||||
### Example 5480
|
||||
|
||||
![foo *bar*][foobar548]
|
||||
|
||||
[FOOBAR548]: train.jpg "train & tracks"
|
||||
|
||||
### Example 549
|
||||
|
||||

|
||||
|
||||
### Example 550
|
||||
|
||||
My 
|
||||
|
||||
### Example 551
|
||||
|
||||

|
||||
|
||||
### Example 552
|
||||
|
||||

|
||||
|
||||
### Example 553
|
||||
|
||||
![foo][bar553]
|
||||
|
||||
[bar553]: /url
|
||||
|
||||
### Example 554
|
||||
|
||||
![foo][bar554]
|
||||
|
||||
[BAR554]: /url
|
||||
|
||||
### Example 555
|
||||
|
||||
![foo][]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 5560
|
||||
|
||||
![*foo* bar][]
|
||||
|
||||
[*foo* bar]: /url "title"
|
||||
|
||||
### Example 557
|
||||
|
||||
![Foo][]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 558
|
||||
|
||||
![foo]
|
||||
[]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 559
|
||||
|
||||
![foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 5600
|
||||
|
||||
![*foo* bar]
|
||||
|
||||
[*foo* bar]: /url "title"
|
||||
|
||||
### Example 561
|
||||
|
||||
![[foo561]]
|
||||
|
||||
[[foo561]]: /url "title"
|
||||
|
||||
### Example 562
|
||||
|
||||
![Foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 563
|
||||
|
||||
!\[foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
||||
### Example 564
|
||||
|
||||
\![foo]
|
||||
|
||||
[foo]: /url "title"
|
||||
|
77
test/new/cm_raw_html.html
Normal file
77
test/new/cm_raw_html.html
Normal file
@ -0,0 +1,77 @@
|
||||
<h1 id="raw-html">Raw HTML</h1>
|
||||
|
||||
<h3 id="example-584">Example 584</h3>
|
||||
|
||||
<p><a><bab><c2c></p>
|
||||
|
||||
<h3 id="example-585">Example 585</h3>
|
||||
|
||||
<p><a/><b2/></p>
|
||||
|
||||
<h3 id="example-586">Example 586</h3>
|
||||
|
||||
<p><a /><b2
|
||||
data="foo" ></p>
|
||||
|
||||
<h3 id="example-587">Example 587</h3>
|
||||
|
||||
<p><a foo="bar" bam = 'baz <em>"</em>'
|
||||
_boolean zoop:33=zoop:33 /></p>
|
||||
|
||||
<h3 id="example-588">Example 588</h3>
|
||||
|
||||
<p>Foo <responsive-image src="foo.jpg" /></p>
|
||||
|
||||
<h3 id="example-589">Example 589</h3>
|
||||
|
||||
<p><33> <__></p>
|
||||
|
||||
<h3 id="example-590">Example 590</h3>
|
||||
|
||||
<p><a h*#ref="hi"></p>
|
||||
|
||||
<h3 id="example-591">Example 591</h3>
|
||||
|
||||
<p><a href="hi'> <a href=hi'></p>
|
||||
|
||||
<h3 id="example-592">Example 592</h3>
|
||||
|
||||
<p>< a><
|
||||
foo><bar/ ></p>
|
||||
|
||||
<h3 id="example-593">Example 593</h3>
|
||||
|
||||
<p><a href='bar'title=title></p>
|
||||
|
||||
<h3 id="example-594">Example 594</h3>
|
||||
|
||||
<p></a></foo ></p>
|
||||
|
||||
<h3 id="example-595">Example 595</h3>
|
||||
|
||||
<p></a href="foo"></p>
|
||||
|
||||
<h3 id="example-596">Example 596</h3>
|
||||
|
||||
<p>foo <!-- this is a
|
||||
comment - with hyphen --></p>
|
||||
|
||||
<h3 id="example-599">Example 599</h3>
|
||||
|
||||
<p>foo <?php echo $a; ?></p>
|
||||
|
||||
<h3 id="example-600">Example 600</h3>
|
||||
|
||||
<p>foo <!ELEMENT br EMPTY></p>
|
||||
|
||||
<h3 id="example-601">Example 601</h3>
|
||||
|
||||
<p>foo <![CDATA[>&<]]></p>
|
||||
|
||||
<h3 id="example-602">Example 602</h3>
|
||||
|
||||
<p>foo <a href="ö"></p>
|
||||
|
||||
<h3 id="example-603">Example 603</h3>
|
||||
|
||||
<p>foo <a href="\*"></p>
|
78
test/new/cm_raw_html.md
Normal file
78
test/new/cm_raw_html.md
Normal file
@ -0,0 +1,78 @@
|
||||
Raw HTML
|
||||
===================
|
||||
|
||||
### Example 584
|
||||
|
||||
<a><bab><c2c>
|
||||
|
||||
### Example 585
|
||||
|
||||
<a/><b2/>
|
||||
|
||||
### Example 586
|
||||
|
||||
<a /><b2
|
||||
data="foo" >
|
||||
|
||||
### Example 587
|
||||
|
||||
<a foo="bar" bam = 'baz <em>"</em>'
|
||||
_boolean zoop:33=zoop:33 />
|
||||
|
||||
### Example 588
|
||||
|
||||
Foo <responsive-image src="foo.jpg" />
|
||||
|
||||
### Example 589
|
||||
|
||||
<33> <__>
|
||||
|
||||
### Example 590
|
||||
|
||||
<a h*#ref="hi">
|
||||
|
||||
### Example 591
|
||||
|
||||
<a href="hi'> <a href=hi'>
|
||||
|
||||
### Example 592
|
||||
|
||||
< a><
|
||||
foo><bar/ >
|
||||
|
||||
### Example 593
|
||||
|
||||
<a href='bar'title=title>
|
||||
|
||||
### Example 594
|
||||
|
||||
</a></foo >
|
||||
|
||||
### Example 595
|
||||
|
||||
</a href="foo">
|
||||
|
||||
### Example 596
|
||||
|
||||
foo <!-- this is a
|
||||
comment - with hyphen -->
|
||||
|
||||
### Example 599
|
||||
|
||||
foo <?php echo $a; ?>
|
||||
|
||||
### Example 600
|
||||
|
||||
foo <!ELEMENT br EMPTY>
|
||||
|
||||
### Example 601
|
||||
|
||||
foo <![CDATA[>&<]]>
|
||||
|
||||
### Example 602
|
||||
|
||||
foo <a href="ö">
|
||||
|
||||
### Example 603
|
||||
|
||||
foo <a href="\*">
|
106
test/new/cm_thematic_breaks.html
Normal file
106
test/new/cm_thematic_breaks.html
Normal file
@ -0,0 +1,106 @@
|
||||
<h1 id="thematic-breaks">Thematic breaks</h1>
|
||||
|
||||
<h3 id="example-13">Example 13</h3>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<h3 id="example-14">Example 14</h3>
|
||||
|
||||
<p>+++</p>
|
||||
|
||||
<h3 id="example-15">Example 15</h3>
|
||||
|
||||
<p>===</p>
|
||||
|
||||
<h3 id="example-16">Example 16</h3>
|
||||
|
||||
<p>--
|
||||
**
|
||||
__</p>
|
||||
|
||||
<h3 id="example-17">Example 17</h3>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<h3 id="example-18">Example 18</h3>
|
||||
|
||||
<pre><code>***
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-19">Example 19</h3>
|
||||
|
||||
<p>Foo
|
||||
***</p>
|
||||
|
||||
<h3 id="example-20">Example 20</h3>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3 id="example-21">Example 21</h3>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3 id="example-22">Example 22</h3>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3 id="example-23">Example 23</h3>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3 id="example-24">Example 24</h3>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3 id="example-25">Example 25</h3>
|
||||
|
||||
<p>_ _ _ _ a</p>
|
||||
<p>a------</p>
|
||||
<p>---a---</p>
|
||||
|
||||
|
||||
<h3 id="example-26">Example 26</h3>
|
||||
|
||||
<p> <em>-</em></p>
|
||||
|
||||
<h3 id="example-27">Example 27</h3>
|
||||
|
||||
<ul>
|
||||
<li>foo</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<ul>
|
||||
<li>bar</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="example-28">Example 28</h3>
|
||||
|
||||
<p>Foo</p>
|
||||
<hr>
|
||||
<p>bar</p>
|
||||
|
||||
<h3 id="example-29">Example 29</h3>
|
||||
|
||||
<h2 id="foo">Foo</h2>
|
||||
<p>bar</p>
|
||||
|
||||
<h3 id="example-30">Example 30</h3>
|
||||
|
||||
<ul>
|
||||
<li>Foo</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<ul>
|
||||
<li>Bar</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="example-31">Example 31</h3>
|
||||
|
||||
<ul>
|
||||
<li>Foo</li>
|
||||
<li><hr></li>
|
||||
</ul>
|
98
test/new/cm_thematic_breaks.md
Normal file
98
test/new/cm_thematic_breaks.md
Normal file
@ -0,0 +1,98 @@
|
||||
Thematic breaks
|
||||
===================
|
||||
|
||||
### Example 13
|
||||
|
||||
***
|
||||
---
|
||||
___
|
||||
|
||||
### Example 14
|
||||
|
||||
+++
|
||||
|
||||
### Example 15
|
||||
|
||||
===
|
||||
|
||||
### Example 16
|
||||
|
||||
--
|
||||
**
|
||||
__
|
||||
|
||||
### Example 17
|
||||
|
||||
***
|
||||
***
|
||||
***
|
||||
|
||||
### Example 18
|
||||
|
||||
***
|
||||
|
||||
### Example 19
|
||||
|
||||
Foo
|
||||
***
|
||||
|
||||
### Example 20
|
||||
|
||||
_____________________________________
|
||||
|
||||
### Example 21
|
||||
|
||||
- - -
|
||||
|
||||
### Example 22
|
||||
|
||||
** * ** * ** * **
|
||||
|
||||
### Example 23
|
||||
|
||||
- - - -
|
||||
|
||||
### Example 24
|
||||
|
||||
- - - -
|
||||
|
||||
### Example 25
|
||||
|
||||
_ _ _ _ a
|
||||
|
||||
a------
|
||||
|
||||
---a---
|
||||
|
||||
### Example 26
|
||||
|
||||
*-*
|
||||
|
||||
### Example 27
|
||||
|
||||
- foo
|
||||
***
|
||||
- bar
|
||||
|
||||
### Example 28
|
||||
|
||||
Foo
|
||||
***
|
||||
bar
|
||||
|
||||
### Example 29
|
||||
|
||||
Foo
|
||||
---
|
||||
bar
|
||||
|
||||
### Example 30
|
||||
|
||||
* Foo
|
||||
* * *
|
||||
* Bar
|
||||
|
||||
### Example 31
|
||||
|
||||
- Foo
|
||||
- * * *
|
@ -6,7 +6,8 @@
|
||||
<hr>
|
||||
|
||||
<blockquote>
|
||||
<p>hello</p>
|
||||
<p>hello
|
||||
[2]: hello</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
@ -24,5 +25,6 @@
|
||||
<blockquote>
|
||||
<p>foo
|
||||
bar
|
||||
[5]: foo
|
||||
bar</p>
|
||||
</blockquote>
|
||||
|
@ -17,5 +17,5 @@
|
||||
|
||||
> foo
|
||||
> bar
|
||||
[1]: foo
|
||||
[5]: foo
|
||||
> bar
|
||||
|
25
test/new/em_2char.html
Normal file
25
test/new/em_2char.html
Normal file
@ -0,0 +1,25 @@
|
||||
<p><em>123</em></p>
|
||||
|
||||
<p><em>123</em></p>
|
||||
|
||||
<p><em>12</em></p>
|
||||
|
||||
<p><em>12</em></p>
|
||||
|
||||
<p><em>1</em></p>
|
||||
|
||||
<p><em>1</em></p>
|
||||
|
||||
<p>__</p>
|
||||
|
||||
<p>**</p>
|
||||
|
||||
<p>_123 _</p>
|
||||
|
||||
<p>*123 *</p>
|
||||
|
||||
<p>_ 123_</p>
|
||||
|
||||
<p><em>1_</em></p>
|
||||
|
||||
<p><em>1*</em></p>
|
25
test/new/em_2char.md
Normal file
25
test/new/em_2char.md
Normal file
@ -0,0 +1,25 @@
|
||||
_123_
|
||||
|
||||
*123*
|
||||
|
||||
_12_
|
||||
|
||||
*12*
|
||||
|
||||
_1_
|
||||
|
||||
*1*
|
||||
|
||||
__
|
||||
|
||||
**
|
||||
|
||||
_123 _
|
||||
|
||||
*123 *
|
||||
|
||||
_ 123_
|
||||
|
||||
_1__
|
||||
|
||||
*1**
|
83
test/new/gfm_autolinks.html
Normal file
83
test/new/gfm_autolinks.html
Normal file
@ -0,0 +1,83 @@
|
||||
<p>link with . <a href="http://example.com/hello-world">http://example.com/hello-world</a>.</p>
|
||||
|
||||
<p>link with ! <a href="http://example.com/hello-world">http://example.com/hello-world</a>!</p>
|
||||
|
||||
<p>link with : <a href="http://example.com/hello-world">http://example.com/hello-world</a>:</p>
|
||||
|
||||
<p>link with , <a href="http://example.com/hello-world">http://example.com/hello-world</a>,</p>
|
||||
|
||||
<p>link with ; <a href="http://example.com/hello-world">http://example.com/hello-world</a>;</p>
|
||||
|
||||
<p>link with ) <a href="http://example.com/hello-world">http://example.com/hello-world</a>)</p>
|
||||
|
||||
<p>link with nothing <a href="http://example.com/hello-world">http://example.com/hello-world</a></p>
|
||||
|
||||
<h3 id="example-597">Example 597</h3>
|
||||
|
||||
<p>The scheme http will be inserted automatically:</p>
|
||||
|
||||
<p><a href="http://www.commonmark.org">www.commonmark.org</a></p>
|
||||
<h3 id="example-598">Example 598</h3>
|
||||
|
||||
<p>After a valid domain, zero or more non-space non-< characters may follow:</p>
|
||||
|
||||
<p>Visit <a href="http://www.commonmark.org/help">www.commonmark.org/help</a> for more information.</p>
|
||||
|
||||
<h3 id="example-599">Example 599</h3>
|
||||
|
||||
<p>Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link:</p>
|
||||
|
||||
<p>Visit <a href="http://www.commonmark.org">www.commonmark.org</a>.</p>
|
||||
|
||||
<p>Visit <a href="http://www.commonmark.org/a.b">www.commonmark.org/a.b</a>.</p>
|
||||
|
||||
<h3 id="example-600">Example 600</h3>
|
||||
|
||||
<p><a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>
|
||||
|
||||
<p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>)</p>
|
||||
|
||||
<h3 id="example-601">Example 601</h3>
|
||||
|
||||
<p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>
|
||||
|
||||
<h3 id="example-602">Example 602</h3>
|
||||
|
||||
<p><a href="http://www.google.com/search?q=commonmark&hl=en">www.google.com/search?q=commonmark&hl=en</a></p>
|
||||
|
||||
<p><a href="http://www.google.com/search?q=commonmark">www.google.com/search?q=commonmark</a>&</p>
|
||||
|
||||
<h3 id="example-603">Example 603</h3>
|
||||
|
||||
<p>< immediately ends an autolink.</p>
|
||||
|
||||
<p><a href="http://www.commonmark.org/he">www.commonmark.org/he</a><lp</p>
|
||||
|
||||
<h3 id="example-604">Example 604</h3>
|
||||
|
||||
<p><a href="http://commonmark.org">http://commonmark.org</a></p>
|
||||
|
||||
<p>(Visit <a href="https://encrypted.google.com/search?q=Markup+(business)">https://encrypted.google.com/search?q=Markup+(business)</a>)</p>
|
||||
|
||||
<p>Anonymous FTP is available at <a href="ftp://foo.bar.baz">ftp://foo.bar.baz</a>.</p>
|
||||
|
||||
<p>Extended email autolinks:</p>
|
||||
|
||||
<h3 id="example-605">Example 605</h3>
|
||||
|
||||
<p><a href="mailto:foo@bar.baz">foo@bar.baz</a></p>
|
||||
|
||||
<h3 id="example-606">Example 606</h3>
|
||||
|
||||
<p>hello@mail+xyz.example isn't valid, but <a href="mailto:hello+xyz@mail.example">hello+xyz@mail.example</a> is.</p>
|
||||
|
||||
<h3 id="example-607">Example 607</h3>
|
||||
|
||||
<p><a href="mailto:a.b-c_d@a.b">a.b-c_d@a.b</a></p>
|
||||
|
||||
<p><a href="mailto:a.b-c_d@a.b">a.b-c_d@a.b</a>.</p>
|
||||
|
||||
<p>a.b-c_d@a.b-</p>
|
||||
|
||||
<pre><code>a.b-c_d@a.b_
|
||||
</code></pre>
|
83
test/new/gfm_autolinks.md
Normal file
83
test/new/gfm_autolinks.md
Normal file
@ -0,0 +1,83 @@
|
||||
link with . http://example.com/hello-world.
|
||||
|
||||
link with ! http://example.com/hello-world!
|
||||
|
||||
link with : http://example.com/hello-world:
|
||||
|
||||
link with , http://example.com/hello-world,
|
||||
|
||||
link with ; http://example.com/hello-world;
|
||||
|
||||
link with ) http://example.com/hello-world)
|
||||
|
||||
link with nothing http://example.com/hello-world
|
||||
|
||||
### Example 597
|
||||
|
||||
The scheme http will be inserted automatically:
|
||||
|
||||
www.commonmark.org
|
||||
|
||||
### Example 598
|
||||
|
||||
After a valid domain, zero or more non-space non-< characters may follow:
|
||||
|
||||
Visit www.commonmark.org/help for more information.
|
||||
|
||||
### Example 599
|
||||
|
||||
Trailing punctuation (specifically, ?, !, ., ,, :, \*, \_, and ~) will not be considered part of the autolink, though they may be included in the interior of the link:
|
||||
|
||||
Visit www.commonmark.org.
|
||||
|
||||
Visit www.commonmark.org/a.b.
|
||||
|
||||
### Example 600
|
||||
|
||||
www.google.com/search?q=Markup+(business)
|
||||
|
||||
(www.google.com/search?q=Markup+(business))
|
||||
|
||||
### Example 601
|
||||
|
||||
www.google.com/search?q=(business))+ok
|
||||
|
||||
### Example 602
|
||||
|
||||
www.google.com/search?q=commonmark&hl=en
|
||||
|
||||
www.google.com/search?q=commonmark&
|
||||
|
||||
### Example 603
|
||||
|
||||
< immediately ends an autolink.
|
||||
|
||||
www.commonmark.org/he<lp
|
||||
|
||||
### Example 604
|
||||
|
||||
http://commonmark.org
|
||||
|
||||
(Visit https://encrypted.google.com/search?q=Markup+(business))
|
||||
|
||||
Anonymous FTP is available at ftp://foo.bar.baz.
|
||||
|
||||
Extended email autolinks:
|
||||
|
||||
### Example 605
|
||||
|
||||
foo@bar.baz
|
||||
|
||||
### Example 606
|
||||
|
||||
hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.
|
||||
|
||||
### Example 607
|
||||
|
||||
a.b-c_d@a.b
|
||||
|
||||
a.b-c_d@a.b.
|
||||
|
||||
a.b-c_d@a.b-
|
||||
|
||||
a.b-c_d@a.b_
|
@ -1,2 +0,0 @@
|
||||
<p>This should be a link:
|
||||
<a href="http://example.com/hello-world">http://example.com/hello-world</a>.</p>
|
@ -1 +0,0 @@
|
||||
This should be a link: http://example.com/hello-world.
|
@ -9,11 +9,11 @@
|
||||
</table>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th style="text-align:center">Header 1</th><th style="text-align:right">Header 2</th><th style="text-align:left">Header 3</th><th>Header 4</th></tr>
|
||||
<tr><th align="center">Header 1</th><th align="right">Header 2</th><th align="left">Header 3</th><th>Header 4</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td style="text-align:center">Cell 1</td><td style="text-align:right">Cell 2</td><td style="text-align:left">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td style="text-align:center">Cell 5</td><td style="text-align:right">Cell 6</td><td style="text-align:left">Cell 7</td><td>Cell 8</td></tr>
|
||||
<tr><td align="center">Cell 1</td><td align="right">Cell 2</td><td align="left">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td align="center">Cell 5</td><td align="right">Cell 6</td><td align="left">Cell 7</td><td>Cell 8</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<pre><code>Test code</code></pre>
|
||||
@ -28,10 +28,10 @@
|
||||
</table>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th style="text-align:left">Header 1</th><th style="text-align:center">Header 2</th><th style="text-align:right">Header 3</th><th>Header 4</th></tr>
|
||||
<tr><th align="left">Header 1</th><th align="center">Header 2</th><th align="right">Header 3</th><th>Header 4</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td style="text-align:left">Cell 1</td><td style="text-align:center">Cell 2</td><td style="text-align:right">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td style="text-align:left"><em>Cell 5</em></td><td style="text-align:center">Cell 6</td><td style="text-align:right">Cell 7</td><td>Cell 8</td></tr>
|
||||
<tr><td align="left">Cell 1</td><td align="center">Cell 2</td><td align="right">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td align="left"><em>Cell 5</em></td><td align="center">Cell 6</td><td align="right">Cell 7</td><td>Cell 8</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
13
test/new/headings_id.html
Normal file
13
test/new/headings_id.html
Normal file
@ -0,0 +1,13 @@
|
||||
<h3 id="heading-with-a-link">Heading with a <a href="http://github.com/">link</a></h3>
|
||||
|
||||
<h3 id="heading-with-some-italic-text">Heading with some <em>italic text</em></h3>
|
||||
|
||||
<h3 id="or-some-strong">Or some <strong>strong</strong></h3>
|
||||
|
||||
<p>(which doesn't really make any difference, here)</p>
|
||||
|
||||
<h3 id="or-even-code">Or even <code>code</code></h3>
|
||||
|
||||
<h3 id="what-about-strikethrough">What about <del>strikethrough</del></h3>
|
||||
|
||||
<h2 id="and-a-ref-link">And a ref <a href="/some/url" title="link to nowhere">link</a></h2>
|
14
test/new/headings_id.md
Normal file
14
test/new/headings_id.md
Normal file
@ -0,0 +1,14 @@
|
||||
### Heading with a [link](http://github.com/)
|
||||
|
||||
### Heading with some _italic text_
|
||||
|
||||
### Or some **strong**
|
||||
(which doesn't really make any difference, here)
|
||||
|
||||
### Or even `code`
|
||||
|
||||
### What about ~~strikethrough~~
|
||||
|
||||
## And a ref [link][destination]
|
||||
|
||||
[destination]: /some/url "link to nowhere"
|
57
test/new/html_comments.html
Normal file
57
test/new/html_comments.html
Normal file
@ -0,0 +1,57 @@
|
||||
<h3 id="example-1">Example 1</h3>
|
||||
|
||||
<!-- comment -->
|
||||
|
||||
<h3 id="example-2">Example 2</h3>
|
||||
|
||||
<!---->
|
||||
|
||||
<h3 id="example-3">Example 3</h3>
|
||||
|
||||
<!-- -->
|
||||
|
||||
<h3 id="example-4">Example 4</h3>
|
||||
|
||||
<!-- - -->
|
||||
|
||||
<h3 id="example-5">Example 5</h3>
|
||||
|
||||
<!-- -- -->
|
||||
|
||||
<h3 id="example-6">Example 6</h3>
|
||||
|
||||
<!-- --->
|
||||
|
||||
<h3 id="example-7">Example 7</h3>
|
||||
|
||||
<!----->
|
||||
|
||||
<h3 id="example-8">Example 8</h3>
|
||||
|
||||
<!------>
|
||||
|
||||
<h3 id="example-9">Example 9</h3>
|
||||
|
||||
<!-- My favorite operators are > and <!-->
|
||||
|
||||
<h3 id="example-10">Example 10</h3>
|
||||
|
||||
<!-- multi
|
||||
line
|
||||
comment
|
||||
-->
|
||||
|
||||
<h3 id="example-11">Example 11</h3>
|
||||
|
||||
<!-- indented comment -->
|
||||
|
||||
<pre><code><!-- too much indentation -->
|
||||
</code></pre>
|
||||
|
||||
<h3 id="example-12">Example 12</h3>
|
||||
|
||||
<p><!--> not a comment --></p>
|
||||
|
||||
<p><!---> not a comment --></p>
|
||||
|
||||
<!-- <!-- not a comment? --> -->
|
56
test/new/html_comments.md
Normal file
56
test/new/html_comments.md
Normal file
@ -0,0 +1,56 @@
|
||||
### Example 1
|
||||
|
||||
<!-- comment -->
|
||||
|
||||
### Example 2
|
||||
|
||||
<!---->
|
||||
|
||||
### Example 3
|
||||
|
||||
<!-- -->
|
||||
|
||||
### Example 4
|
||||
|
||||
<!-- - -->
|
||||
|
||||
### Example 5
|
||||
|
||||
<!-- -- -->
|
||||
|
||||
### Example 6
|
||||
|
||||
<!-- --->
|
||||
|
||||
### Example 7
|
||||
|
||||
<!----->
|
||||
|
||||
### Example 8
|
||||
|
||||
<!------>
|
||||
|
||||
### Example 9
|
||||
|
||||
<!-- My favorite operators are > and <!-->
|
||||
|
||||
### Example 10
|
||||
|
||||
<!-- multi
|
||||
line
|
||||
comment
|
||||
-->
|
||||
|
||||
### Example 11
|
||||
|
||||
<!-- indented comment -->
|
||||
|
||||
<!-- too much indentation -->
|
||||
|
||||
### Example 12
|
||||
|
||||
<!--> not a comment -->
|
||||
|
||||
<!---> not a comment -->
|
||||
|
||||
<!-- <!-- not a comment? --> -->
|
1
test/new/link_lt.html
Normal file
1
test/new/link_lt.html
Normal file
@ -0,0 +1 @@
|
||||
<p><a href="%3Ctest">URL</a></p>
|
1
test/new/link_lt.md
Normal file
1
test/new/link_lt.md
Normal file
@ -0,0 +1 @@
|
||||
[URL](<test)
|
@ -1,62 +0,0 @@
|
||||
<p>Foo <a href="/url/" title="Title">bar</a>.</p>
|
||||
|
||||
<p>Foo <a href="/url/" title="Title">bar</a>.</p>
|
||||
|
||||
<p>Foo <a href="/url/" title="Title">bar</a>.</p>
|
||||
|
||||
<p>With <a href="/url/">embedded [brackets]</a>.</p>
|
||||
|
||||
<p>Indented <a href="/url">once</a>.</p>
|
||||
|
||||
<p>Indented <a href="/url">twice</a>.</p>
|
||||
|
||||
<p>Indented <a href="/url">thrice</a>.</p>
|
||||
|
||||
<p>Indented [four][] times.</p>
|
||||
|
||||
<pre><code>[four]: /url
|
||||
</code></pre>
|
||||
|
||||
<hr>
|
||||
|
||||
<p><a href="foo">this</a> should work</p>
|
||||
|
||||
<p>So should <a href="foo">this</a>.</p>
|
||||
|
||||
<p>And <a href="foo">this</a>.</p>
|
||||
|
||||
<p>And <a href="foo">this</a>.</p>
|
||||
|
||||
<p>And <a href="foo">this</a>.</p>
|
||||
|
||||
<p>But not [that] [].</p>
|
||||
|
||||
<p>Nor [that][].</p>
|
||||
|
||||
<p>Nor [that].</p>
|
||||
|
||||
<p>[Something in brackets like <a href="foo">this</a> should work]</p>
|
||||
|
||||
<p>[Same with <a href="foo">this</a>.]</p>
|
||||
|
||||
<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>
|
||||
|
||||
<p>Backslashing should suppress [this] and [this].</p>
|
||||
|
||||
<p>A link reference definition cannot interrupt a paragraph.
|
||||
[bar]: /baz</p>
|
||||
<p>[bar]</p>
|
||||
|
||||
<p>However, it can directly follow other block elements, such as headings</p>
|
||||
<h1 id="-foo-"><a href="/url">Foo</a></h1>
|
||||
<blockquote>
|
||||
<p>bar</p>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Here's one where the <a href="/url/">link
|
||||
breaks</a> across lines.</p>
|
||||
|
||||
<p>Here's another where the <a href="/url/">link
|
||||
breaks</a> across lines, but with a line-ending space.</p>
|
@ -1,81 +0,0 @@
|
||||
Foo [bar] [1].
|
||||
|
||||
Foo [bar][1].
|
||||
|
||||
Foo [bar]
|
||||
[1].
|
||||
|
||||
[1]: /url/ "Title"
|
||||
|
||||
|
||||
With [embedded [brackets]] [b].
|
||||
|
||||
|
||||
Indented [once][].
|
||||
|
||||
Indented [twice][].
|
||||
|
||||
Indented [thrice][].
|
||||
|
||||
Indented [four][] times.
|
||||
|
||||
[once]: /url
|
||||
|
||||
[twice]: /url
|
||||
|
||||
[thrice]: /url
|
||||
|
||||
[four]: /url
|
||||
|
||||
|
||||
[b]: /url/
|
||||
|
||||
* * *
|
||||
|
||||
[this] [this] should work
|
||||
|
||||
So should [this][this].
|
||||
|
||||
And [this] [].
|
||||
|
||||
And [this][].
|
||||
|
||||
And [this].
|
||||
|
||||
But not [that] [].
|
||||
|
||||
Nor [that][].
|
||||
|
||||
Nor [that].
|
||||
|
||||
[Something in brackets like [this][] should work]
|
||||
|
||||
[Same with [this].]
|
||||
|
||||
In this case, [this](/somethingelse/) points to something else.
|
||||
|
||||
Backslashing should suppress \[this] and [this\].
|
||||
|
||||
[this]: foo
|
||||
|
||||
A link reference definition cannot interrupt a paragraph.
|
||||
[bar]: /baz
|
||||
|
||||
[bar]
|
||||
|
||||
However, it can directly follow other block elements, such as headings
|
||||
|
||||
# [Foo]
|
||||
[foo]: /url
|
||||
> bar
|
||||
|
||||
* * *
|
||||
|
||||
Here's one where the [link
|
||||
breaks] across lines.
|
||||
|
||||
Here's another where the [link
|
||||
breaks] across lines, but with a line-ending space.
|
||||
|
||||
|
||||
[link breaks]: /url/
|
@ -1,3 +1,3 @@
|
||||
<p><<a href="mailto:svg/onload="alert(1)"//@x">svg/onload="alert(1)"//@x</a></p>
|
||||
<p><<svg/onload="alert(1)"//@x></p>
|
||||
|
||||
<p><a href="mailto:bar"onclick="alert('XSS')"@foo">bar"onclick="alert('XSS')"@foo</a></p>
|
||||
<p><bar"onclick="alert('XSS')"@foo></p>
|
||||
|
@ -1 +1,9 @@
|
||||
<p><code>hi ther `` ok ```</code></p>
|
||||
|
||||
<p><code>`</code></p>
|
||||
|
||||
<p><code>There is a literal backtick (`) here.</code></p>
|
||||
|
||||
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
|
||||
<p>Please don't use any <code><blink></code> tags.</p>
|
@ -1 +1,9 @@
|
||||
````` hi ther `` ok ``` `````
|
||||
|
||||
`` ` ``
|
||||
|
||||
``There is a literal backtick (`) here.``
|
||||
|
||||
A backtick-delimited string in a code span: `` `foo` ``
|
||||
|
||||
Please don't use any `<blink>` tags.
|
@ -1 +1,3 @@
|
||||
<p><a href="/url">the <code>]</code> character</a></p>
|
||||
|
||||
<p><a href="/url">the ` character</a></p>
|
||||
|
@ -1 +1,3 @@
|
||||
[the `]` character](/url)
|
||||
|
||||
[the ` character](/url)
|
||||
|
0
test/new/redos_html_closing.html
Normal file
0
test/new/redos_html_closing.html
Normal file
1
test/new/redos_html_closing.md
Normal file
1
test/new/redos_html_closing.md
Normal file
@ -0,0 +1 @@
|
||||
<tag "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""<" />a'a
|
0
test/new/redos_nolink.html
Normal file
0
test/new/redos_nolink.html
Normal file
1
test/new/redos_nolink.md
Normal file
1
test/new/redos_nolink.md
Normal file
@ -0,0 +1 @@
|
||||
![\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]\[[]!\
|
@ -1,30 +1,30 @@
|
||||
<p>hello world
|
||||
how are you
|
||||
how are you</p>
|
||||
text after spaces
|
||||
text after spaces</p>
|
||||
|
||||
<p>hello world</p>
|
||||
<pre><code>how are you</code></pre>
|
||||
<p>paragraph before code</p>
|
||||
<pre><code>text inside block code</code></pre>
|
||||
|
||||
<p>hello world</p>
|
||||
<p>paragraph before hr</p>
|
||||
<hr>
|
||||
|
||||
<p>hello world</p>
|
||||
<p>paragraph before head with hash</p>
|
||||
<h1 id="how-are-you">how are you</h1>
|
||||
|
||||
<p>hello world</p>
|
||||
<p>paragraph before head with equals</p>
|
||||
<h1 id="how-are-you">how are you</h1>
|
||||
|
||||
<p>hello world</p>
|
||||
<blockquote><p>how are you</p></blockquote>
|
||||
<p>paragraph before blockquote</p>
|
||||
<blockquote><p>text for blockquote</p></blockquote>
|
||||
|
||||
<p>hello world</p>
|
||||
<ul><li>how are you</li></ul>
|
||||
<p>paragraph before list</p>
|
||||
<ul><li>text inside list</li></ul>
|
||||
|
||||
<p>hello world</p>
|
||||
<div>how are you</div>
|
||||
<p>paragraph before div</p>
|
||||
<div>text inside div</div>
|
||||
|
||||
<p>hello world
|
||||
<span>how are you</span></p>
|
||||
<p>paragraph with span
|
||||
<span>text inside span</span></p>
|
||||
|
||||
<p>hello <a href="/are/you">world</a>
|
||||
</p>
|
||||
|
@ -2,35 +2,35 @@
|
||||
gfm: true
|
||||
---
|
||||
hello world
|
||||
how are you
|
||||
how are you
|
||||
text after spaces
|
||||
text after spaces
|
||||
|
||||
hello world
|
||||
paragraph before code
|
||||
```
|
||||
how are you
|
||||
text inside block code
|
||||
```
|
||||
|
||||
hello world
|
||||
paragraph before hr
|
||||
* * *
|
||||
|
||||
hello world
|
||||
paragraph before head with hash
|
||||
# how are you
|
||||
|
||||
hello world
|
||||
paragraph before head with equals
|
||||
how are you
|
||||
===========
|
||||
|
||||
hello world
|
||||
> how are you
|
||||
paragraph before blockquote
|
||||
> text for blockquote
|
||||
|
||||
hello world
|
||||
* how are you
|
||||
paragraph before list
|
||||
* text inside list
|
||||
|
||||
hello world
|
||||
<div>how are you</div>
|
||||
paragraph before div
|
||||
<div>text inside div</div>
|
||||
|
||||
hello world
|
||||
<span>how are you</span>
|
||||
paragraph with span
|
||||
<span>text inside span</span>
|
||||
|
||||
hello [world][how]
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
AT&T has an ampersand in their name.
|
||||
|
||||
AT&T is another way to write it.
|
||||
|
@ -69,3 +69,17 @@
|
||||
|
||||
<pre><code>_ _ _
|
||||
</code></pre>
|
||||
|
||||
<p>Not horizontal rules:</p>
|
||||
<p>--*</p>
|
||||
<p>-*-</p>
|
||||
<p>*--</p>
|
||||
<p>-_-</p>
|
||||
<p>__-</p>
|
||||
<p>-__</p>
|
||||
<pre><code>_-_
|
||||
</code></pre>
|
||||
<p>Long rules:</p>
|
||||
<hr>
|
||||
<hr>
|
||||
<hr>
|
||||
|
@ -65,3 +65,30 @@ _ _ _
|
||||
_ _ _
|
||||
|
||||
_ _ _
|
||||
|
||||
|
||||
|
||||
Not horizontal rules:
|
||||
|
||||
--*
|
||||
|
||||
-*-
|
||||
|
||||
*--
|
||||
|
||||
-_-
|
||||
|
||||
__-
|
||||
|
||||
-__
|
||||
|
||||
_-_
|
||||
|
||||
|
||||
Long rules:
|
||||
|
||||
-----------
|
||||
|
||||
___________
|
||||
|
||||
***********
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>
|
||||
|
||||
<p><a href="/url/has space">URL and title</a>.</p>
|
||||
<p><a href="/url/has%20space">URL and title</a>.</p>
|
||||
|
||||
<p><a href="/url/has space/" title="url has space and title">URL and title</a>.</p>
|
||||
<p><a href="/url/has%20space/" title="url has space and title">URL and title</a>.</p>
|
||||
|
||||
<p><a href="">Empty</a>.</p>
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
Just a [URL](/url/).
|
||||
|
||||
[URL and title](/url/ "title").
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
Foo [bar] [1].
|
||||
|
||||
Foo [bar][1].
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
This is the [simple case].
|
||||
|
||||
[simple case]: /simple
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
Foo [bar][].
|
||||
|
||||
Foo [bar](/url/ "Title with "quotes" inside").
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
Markdown: Basics
|
||||
================
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
pedantic: true
|
||||
---
|
||||
|
||||
Markdown: Syntax
|
||||
================
|
||||
|
||||
|
@ -146,3 +146,19 @@ back.</p></li>
|
||||
|
||||
<p>that</p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Ordered lists start from initial number:</p>
|
||||
|
||||
<ol start="3">
|
||||
<li>Three</li>
|
||||
<li>Four</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<p>Ordered lists start from initial zero:</p>
|
||||
|
||||
<ol start="0">
|
||||
<li>Zero</li>
|
||||
<li>One</li>
|
||||
</ol>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user