Fix: img tag did not allow width and height.

Removed swipebox from markdown editor img tag and
updated marked markdown to newest version.

Thanks to hradec and xet7 !

Closes #2956
This commit is contained in:
Lauri Ojansivu 2020-03-06 03:52:12 +02:00
parent a6d702d1ab
commit 2b26bbe78a
216 changed files with 7529 additions and 16839 deletions

View file

@ -57,6 +57,9 @@ const sanitizeXss = (input, options) => {
}
}
}
/* Don't use swipebox on markdown, so that img tag can now use width
* and height parameters. https://github.com/wekan/wekan/issues/2956
* Previously this was added at https://github.com/wekan/wekan/pull/2593
} else if (tag === 'img') {
if (!options.isClosing) {
const src = getAttr('src');
@ -64,6 +67,7 @@ const sanitizeXss = (input, options) => {
return `<a href='${src}' class='swipebox'><img src='${src}' class="attachment-image-preview mCS_img_loaded"></a>`;
}
}
*/
}
return undefined;
},

View file

@ -1,16 +0,0 @@
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

View file

@ -1 +0,0 @@
*.min.js

View file

@ -1,2 +0,0 @@
test/* linguist-vendored

View file

@ -1,42 +0,0 @@
**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
-->

View file

@ -1,27 +0,0 @@
---
name: Bug report
about: Marked says it does this thing but does not
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
<!-- If possible, use the Marked Demo permalink and compare to the CommonMark Dingus permalink to demonstrate the bug -->
<!--
1. [Marked Demo](https://marked.js.org/demo/)
2. [CommonMark Demo](https://spec.commonmark.org/dingus/)
-->
<!-- If you need a specific version and options to reproduce the bug, use the following template -->
<!--
1. Install marked `npm install --save marked@0.3.19` with the version you are using
2. Run marked with input string and options such as `marked('hello *world*', {gfm: true})`
3. Actual output (or error) is...
-->
**Expected behavior**
A clear and concise description of what you expected to happen.

View file

@ -1,14 +0,0 @@
---
name: Feature request
about: Marked doesn't do this thing and I think it should
---
**Describe the feature**
A clear and concise description of what you would like.
**Why is this feature necessary?**
A clear and concise description of why.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

View file

@ -1,11 +0,0 @@
---
name: Proposal
about: Marked doesn't do this thing and I think it should
---
**What pain point are you perceiving?.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

View file

@ -1,53 +0,0 @@
<!--
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

View file

@ -1,50 +0,0 @@
**@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.

View file

@ -1,25 +0,0 @@
## 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).

View file

@ -1,3 +0,0 @@
.DS_Store
node_modules/
test/compiled_tests

View file

@ -1,46 +0,0 @@
language: node_js
jobs:
fast_finish: true
allow_failures:
- stage: security scan 🔐
include:
- stage: unit tests 👩🏽‍💻
script: npm run test:unit
node_js: lts/*
- stage: spec tests 👩🏽‍💻
script: npm run test:specs
node_js: v4
- node_js: lts/*
- node_js: node
- 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
- stage: security scan 🔐
script: npm run test:redos
node_js: lts/*
cache:
directories:
- node_modules
git:
depth: 3

View file

@ -1,15 +0,0 @@
all:
@cp lib/marked.js marked.js
@uglifyjs --comments '/\*[^\0]+?Copyright[^\0]+?\*/' -o marked.min.js lib/marked.js
clean:
@rm marked.js
@rm marked.min.js
bench:
@node test --bench
man/marked.1.txt:
groff -man -Tascii man/marked.1 | col -b > man/marked.1.txt
.PHONY: clean all

View file

@ -39,7 +39,7 @@ Also read about:
## Usage
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
**CLI**

View file

@ -0,0 +1,10 @@
# Security Policy
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.
## Reporting a Vulnerability
Please disclose potential security issues by email to the project [committers](https://marked.js.org/#/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).

View file

@ -1,215 +0,0 @@
#!/usr/bin/env node
/**
* Marked CLI
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
*/
var fs = require('fs'),
path = require('path'),
marked = require('../');
/**
* Man Page
*/
function help() {
var spawn = require('child_process').spawn;
var options = {
cwd: process.cwd(),
env: process.env,
setsid: false,
stdio: 'inherit'
};
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);
});
});
}
function version() {
var pkg = require('../package.json');
console.log(pkg.version);
}
/**
* Main
*/
function main(argv, callback) {
var files = [],
options = {},
input,
output,
string,
arg,
tokens,
opt;
function getarg() {
var arg = argv.shift();
if (arg.indexOf('--') === 0) {
// e.g. --opt
arg = arg.split('=');
if (arg.length > 1) {
// e.g. --opt=val
argv.unshift(arg.slice(1).join('='));
}
arg = arg[0];
} else if (arg[0] === '-') {
if (arg.length > 2) {
// e.g. -abc
argv = arg.substring(1).split('').map(function(ch) {
return '-' + ch;
}).concat(argv);
arg = argv.shift();
} else {
// e.g. -a
}
} else {
// e.g. foo
}
return arg;
}
while (argv.length) {
arg = getarg();
switch (arg) {
case '--test':
return require('../test').main(process.argv.slice());
case '-o':
case '--output':
output = argv.shift();
break;
case '-i':
case '--input':
input = argv.shift();
break;
case '-s':
case '--string':
string = argv.shift();
break;
case '-t':
case '--tokens':
tokens = true;
break;
case '-h':
case '--help':
return help();
case '-v':
case '--version':
return version();
default:
if (arg.indexOf('--') === 0) {
opt = camelize(arg.replace(/^--(no-)?/, ''));
if (!marked.defaults.hasOwnProperty(opt)) {
continue;
}
if (arg.indexOf('--no-') === 0) {
options[opt] = typeof marked.defaults[opt] !== 'boolean'
? null
: false;
} else {
options[opt] = typeof marked.defaults[opt] !== 'boolean'
? argv.shift()
: true;
}
} else {
files.push(arg);
}
break;
}
}
function getData(callback) {
if (!input) {
if (files.length <= 2) {
if (string) {
return callback(null, string);
}
return getStdin(callback);
}
input = files.pop();
}
return fs.readFile(input, 'utf8', callback);
}
return getData(function(err, data) {
if (err) return callback(err);
data = tokens
? JSON.stringify(marked.lexer(data, options), null, 2)
: marked(data, options);
if (!output) {
process.stdout.write(data + '\n');
return callback();
}
return fs.writeFile(output, data, callback);
});
}
/**
* Helpers
*/
function getStdin(callback) {
var stdin = process.stdin,
buff = '';
stdin.setEncoding('utf8');
stdin.on('data', function(data) {
buff += data;
});
stdin.on('error', function(err) {
return callback(err);
});
stdin.on('end', function() {
return callback(null, buff);
});
try {
stdin.resume();
} catch (e) {
callback(e);
}
}
function camelize(text) {
return text.replace(/(\w)-(\w)/g, function(_, a, b) {
return a + b.toUpperCase();
});
}
function handleError(err) {
if (err.code === 'ENOENT') {
console.error(`marked: output to ${err.path}: No such directory`);
return process.exit(1);
}
throw err;
}
/**
* Expose / Entry Point
*/
if (!module.parent) {
process.title = 'marked';
main(process.argv.slice(), function(err, code) {
if (err) return handleError(err);
return process.exit(code || 0);
});
} else {
module.exports = main;
}

View file

@ -1,23 +0,0 @@
{
"name": "marked",
"homepage": "https://github.com/markedjs/marked",
"authors": [
"Christopher Jeffrey <chjjeffrey@gmail.com>"
],
"description": "A markdown parser built for speed",
"keywords": [
"markdown",
"markup",
"html"
],
"main": "lib/marked.js",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/bower_components",
"test",
"tests"
]
}

View file

@ -1,10 +0,0 @@
{
"name": "marked",
"version": "0.3.4",
"repo": "markedjs/marked",
"description": "A markdown parser built for speed",
"keywords": ["markdown", "markup", "html"],
"scripts": ["lib/marked.js"],
"main": "lib/marked.js",
"license": "MIT"
}

View file

@ -3,27 +3,31 @@
"plugins": [
"standard"
],
"parserOptions": { "ecmaVersion": 5 },
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"rules": {
"semi": ["error", "always"],
"indent": ["warn", 2, {
"VariableDeclarator": { "var": 2 },
"indent": ["error", 2, {
"SwitchCase": 1,
"VariableDeclarator": { "var": 2 },
"outerIIFEBody": 0
}],
"space-before-function-paren": "off",
"object-curly-spacing": "off",
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
"space-before-function-paren": ["error", "never"],
"no-cond-assign": "off",
"no-useless-escape": "off",
"no-return-assign": "off",
"one-var": "off",
"no-control-regex": "off"
"no-control-regex": "off",
"no-prototype-builtins": "off",
"prefer-const": "off",
"no-var": "off"
},
"env": {
"node": true,
"browser": true,
"amd": true,
"jasmine": true
"amd": true
}
}

View file

@ -1,6 +1,6 @@
# 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 group encompases the following groups.
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 group encompasses the following groups.
<table>
<tbody>
@ -170,7 +170,7 @@ To be removed: You can remove yourself through the [GitHub UI](https://help.gith
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.
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, whether 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)
@ -227,7 +227,7 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr
</blockquote>
</dd>
<dt>Dr. Docs</dt>
<dd>Someone who has contributed a great deal to the creation and maintainance of the non-code areas of marked.</dd>
<dd>Someone who has contributed a great deal to the creation and maintenance of the non-code areas of marked.</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>
@ -259,9 +259,9 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and&hellip;dr
<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>
<dd>A contributor who stepped up to help bring Marked back to life by contributing 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>
<dd>This badge is given to the person or organization 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>

View file

@ -5,9 +5,10 @@
- [ ] 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.
- [ ] Update code in `src` folder. (`lib` folder is for auto compiled code)
- [ ] Run `npm run test:all`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
- [ ] Run `npm run build:reset` to remove changes to compiled files.
- [ ] Submit a Pull Request.
## Design principles
@ -30,16 +31,19 @@ The following table lists the ticket type labels we use when there is work to be
|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. |
|NFE - new feature (should be an extension) |A capability Marked does not currently provide and is not part of a spec. |
## 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`.|
|Location |Description |
|:---------------------|:--------------------------------------------------------------------------------------------------------------|
|/test/specs/commonmark|Tests for [CommonMark](https://spec.commonmark.org/current/) compliance |
|/test/specs/gfm |Tests for [GFM](https://github.github.com/gfm/) compliance |
|/test/specs/new |Tests not related to the original `markdown.pl`. |
|/test/specs/original |Tests validating against the original `markdown.pl`. |
|/test/specs/redos |Tests for [ReDOS](https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS) vulnerabilities|
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
@ -84,9 +88,8 @@ To check for (and fix) standardized syntax (lint):
npm run lint
```
To build your own minified version of Marked:
To build your own es5, esm, and minified versions of Marked:
```bash
npm run build
```

View file

@ -7,7 +7,7 @@
## 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.)
**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 features, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
## Versioning
@ -20,5 +20,5 @@ We follow [semantic versioning](https://semver.org) where the following sequence
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).
2. The minor will tend to be more analogous to a `major` release.
3. The patch will tend to be more analogous to a `minor` release or a collection of bug fixes (patches).

View file

@ -25,7 +25,7 @@ These documentation pages are also rendered using marked 💯
<h2 id="usage">Usage</h2>
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
**CLI**
@ -72,8 +72,8 @@ We actively support the features of the following [Markdown flavors](https://git
|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 |
|[CommonMark](http://spec.commonmark.org/0.29/) |0.29 |
|[GitHub Flavored Markdown](https://github.github.com/gfm/) |0.29 |
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.

View file

@ -14,18 +14,19 @@ marked(markdownString [,options] [,callback])
```js
// Create reference instance
var myMarked = require('marked');
const marked = 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;
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code, language) {
const hljs = require('highlight.js');
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext';
return hljs.highlight(validLanguage, code).value;
},
pedantic: false,
gfm: true,
tables: true,
breaks: false,
sanitize: false,
smartLists: true,
@ -34,14 +35,14 @@ myMarked.setOptions({
});
// Compile
console.log(myMarked('I am using __markdown__.'));
console.log(marked(markdownString));
```
<h2 id="options">Options</h2>
|Member |Type |Default |Since |Notes |
|:-----------|:---------|:--------|:--------|:-------------|
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|breaks |`boolean` |`false` |v0.2.7 |If true, add `<br>` on a single line break (copies GitHub). Requires `gfm` be `true`.|
|gfm |`boolean` |`true` |v0.2.1 |If true, 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).|
@ -50,13 +51,12 @@ console.log(myMarked('I am using __markdown__.'));
|langPrefix |`string` |`'language-'`|v0.3.0|A string to prefix the className in a `<code>` block. Useful for syntax highlighting.|
|mangle |`boolean` |`true` |v0.3.4 |If true, autolinked email address is escaped with HTML character references.|
|pedantic |`boolean` |`false` |v0.2.1 |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()`|v0.3.0|An object containing functions to render tokens to HTML. See [extensibility](USING_PRO.md) for more details.|
|sanitize |`boolean` |`false` |v0.2.1 |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.|
|renderer |`object` |`new Renderer()`|v0.3.0|An object containing functions to render tokens to HTML. See [extensibility](/#/USING_PRO.md) for more details.|
|sanitize |`boolean` |`false` |v0.2.1 |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.<br>**Warning**: This feature is deprecated and it should NOT be used as it cannot be considered secure.<br>Instead use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! |
|sanitizer |`function`|`null` |v0.3.4 |A function to sanitize the HTML passed into `markdownString`.|
|silent |`boolean` |`false` |v0.2.7 |If true, the parser does not throw any exception.|
|smartLists |`boolean` |`false` |v0.2.8 |If true, use smarter list behavior than those found in `markdown.pl`.|
|smartypants |`boolean` |`false` |v0.2.9 |If true, use "smart" typographic punctuation for things like quotes and dashes.|
|tables |`boolean` |`true` |v0.2.7 |If true and `gfm` is true, use [GFM Tables extension](https://github.github.com/gfm/#tables-extension-).|
|xhtml |`boolean` |`false` |v0.3.2 |If true, emit self-closing HTML tags for void elements (&lt;br/&gt;, &lt;img/&gt;, etc.) with a "/" as required by XHTML.|
<h2 id="highlight">Asynchronous highlighting</h2>
@ -64,7 +64,7 @@ console.log(myMarked('I am using __markdown__.'));
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({
marked.setOptions({
highlight: function(code, lang, callback) {
require('pygmentize-bundled') ({ lang: lang, format: 'html' }, code, function (err, result) {
callback(err, result.toString());
@ -72,7 +72,81 @@ myMarked.setOptions({
}
});
console.log(myMarked(markdownString));
console.log(marked(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.
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 language to use for the `code` and `callback` is the `function` the asynchronous highlighter will call once complete.
<h2 id="workers">Workers</h2>
To prevent ReDoS attacks you can run marked on a worker and terminate it when parsing takes longer than usual.
Marked can be run in a [worker thread](https://nodejs.org/api/worker_threads.html) on a node server, or a [web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) in a browser.
### Node Worker Thread
```js
// markedWorker.js
const marked = require('marked');
const { parentPort } = require('worker_threads');
parentPort.on('message', (markdownString) => {
parentPort.postMessage(marked(markdownString));
});
```
```js
// index.js
const { Worker } = require('worker_threads');
const markedWorker = new Worker('./markedWorker.js');
const markedTimeout = setTimeout(() => {
markedWorker.terminate();
throw new Error('Marked took too long!');
}, timeoutLimit);
markedWorker.on('message', (html) => {
clearTimeout(markedTimeout);
console.log(html);
markedWorker.terminate();
});
markedWorker.postMessage(markdownString);
```
### Web Worker
> **NOTE**: Web Workers send the payload from `postMessage` in an object with the payload in a `.data` property
```js
// markedWorker.js
importScripts('path/to/marked.min.js');
onmessage = (e) => {
const markdownString = e.data
postMessage(marked(markdownString));
};
```
```js
// script.js
const markedWorker = new Worker('./markedWorker.js');
const markedTimeout = setTimeout(() => {
markedWorker.terminate();
throw new Error('Marked took too long!');
}, timeoutLimit);
markedWorker.onmessage = (e) => {
clearTimeout(markedTimeout);
const html = e.data;
console.log(html);
markedWorker.terminate();
};
markedWorker.postMessage(markdownString);
```

View file

@ -1,6 +1,6 @@
## Extending Marked
To champion the single-responsibility 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.
To champion the single-responsibility and open/closed principles, 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.
<h2 id="renderer">The renderer</h2>
@ -10,14 +10,14 @@ The renderer is...
```js
// Create reference instance
var myMarked = require('marked');
const marked = require('marked');
// Get reference
var renderer = new myMarked.Renderer();
const renderer = new marked.Renderer();
// Override function
renderer.heading = function (text, level) {
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return `
<h${level}>
@ -29,7 +29,7 @@ renderer.heading = function (text, level) {
};
// Run marked
console.log(myMarked('# heading+', { renderer: renderer }));
console.log(marked('# heading+', { renderer: renderer }));
```
**Output:**
@ -105,13 +105,13 @@ The parser is...
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));
const tokens = marked.lexer(text, options);
console.log(marked.parser(tokens, options));
```
``` js
var lexer = new marked.Lexer(options);
var tokens = lexer.lex(text);
const lexer = new marked.Lexer(options);
const tokens = lexer.lex(text);
console.log(tokens);
console.log(lexer.rules);
```

View file

@ -1,4 +1,4 @@
/* globals marked, unfetch, ES6Promise */
/* globals marked, unfetch, ES6Promise, Promise */ // eslint-disable-line no-redeclare
if (!window.Promise) {
window.Promise = ES6Promise;
@ -7,7 +7,7 @@ if (!window.fetch) {
window.fetch = unfetch;
}
onunhandledrejection = function (e) {
onunhandledrejection = function(e) {
throw e.reason;
};
@ -70,7 +70,7 @@ Promise.all([
setInitialText(),
setInitialVersion()
.then(setInitialOptions)
]).then(function () {
]).then(function() {
handleInputChange();
handleOutputChange();
checkForChanges();
@ -84,8 +84,8 @@ function setInitialText() {
$markdownElem.value = search.text;
} else {
return fetch('./initial.md')
.then(function (res) { return res.text(); })
.then(function (text) {
.then(function(res) { return res.text(); })
.then(function(text) {
if ($markdownElem.value === '') {
$markdownElem.value = text;
}
@ -95,18 +95,18 @@ function setInitialText() {
function setInitialQuickref() {
return fetch('./quickref.md')
.then(function (res) { return res.text(); })
.then(function (text) {
.then(function(res) { return res.text(); })
.then(function(text) {
document.querySelector('#quickref').value = text;
});
}
function setInitialVersion() {
return fetch('https://data.jsdelivr.com/v1/package/npm/marked')
.then(function (res) {
.then(function(res) {
return res.json();
})
.then(function (json) {
.then(function(json) {
for (var i = 0; i < json.versions.length; i++) {
var ver = json.versions[i];
markedVersions[ver] = 'https://cdn.jsdelivr.net/npm/marked@' + ver + '/lib/marked.js';
@ -116,20 +116,20 @@ function setInitialVersion() {
$markedVerElem.appendChild(opt);
}
})
.then(function () {
.then(function() {
return fetch('https://api.github.com/repos/markedjs/marked/commits')
.then(function (res) {
.then(function(res) {
return res.json();
})
.then(function (json) {
markedVersions['master'] = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + json[0].sha + '/lib/marked.js';
.then(function(json) {
markedVersions.master = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + json[0].sha + '/lib/marked.js';
})
.catch(function () {
.catch(function() {
// do nothing
// uses url without commit
});
})
.then(function () {
.then(function() {
if (search.version) {
if (markedVersions[search.version]) {
return search.version;
@ -142,7 +142,7 @@ function setInitialVersion() {
return search.version;
case 'pr':
return getPrCommit(match[2])
.then(function (commit) {
.then(function(commit) {
if (!commit) {
return 'master';
}
@ -156,7 +156,7 @@ function setInitialVersion() {
return 'master';
})
.then(function (version) {
.then(function(version) {
$markedVerElem.value = version;
})
.then(updateVersion);
@ -220,7 +220,7 @@ function handleAddVersion(e) {
$commitVerElem.disabled = true;
var pr = $commitVerElem.value.replace(/\D/g, '');
getPrCommit(pr)
.then(function (commit) {
.then(function(commit) {
$commitVerElem.disabled = false;
if (!commit) {
alert('That is not a valid PR');
@ -271,12 +271,12 @@ function addCommitVersion(value, text, commit) {
function getPrCommit(pr) {
return fetch('https://api.github.com/repos/markedjs/marked/pulls/' + pr + '/commits')
.then(function (res) {
.then(function(res) {
return res.json();
})
.then(function (json) {
.then(function(json) {
return json[json.length - 1].sha;
}).catch(function () {
}).catch(function() {
// return undefined
});
}
@ -296,7 +296,7 @@ function setDefaultOptions() {
function setOptions(opts) {
$optionsElem.value = JSON.stringify(
opts,
function (key, value) {
function(key, value) {
if (value && typeof value === 'object' && Object.getPrototypeOf(value) !== Object.prototype) {
return undefined;
}
@ -375,13 +375,13 @@ function updateVersion() {
promise = Promise.resolve(markedVersionCache[$markedVerElem.value]);
} else {
promise = fetch(markedVersions[$markedVerElem.value])
.then(function (res) { return res.text(); })
.then(function (text) {
.then(function(res) { return res.text(); })
.then(function(text) {
markedVersionCache[$markedVerElem.value] = text;
return text;
});
}
return promise.then(function (text) {
return promise.then(function(text) {
var script = document.createElement('script');
script.textContent = text;
@ -479,7 +479,7 @@ function messageWorker(message) {
markedWorker.terminate();
}
markedWorker = new Worker('worker.js');
markedWorker.onmessage = function (e) {
markedWorker.onmessage = function(e) {
clearTimeout(markedWorker.timeout);
markedWorker.working = false;
switch (e.data.task) {
@ -500,7 +500,7 @@ function messageWorker(message) {
delayTime = 10;
checkForChanges();
};
markedWorker.onerror = markedWorker.onmessageerror = function (err) {
markedWorker.onerror = markedWorker.onmessageerror = function(err) {
clearTimeout(markedWorker.timeout);
var error = 'There was an error in the Worker';
if (err) {
@ -526,7 +526,7 @@ function messageWorker(message) {
}
function workerTimeout(seconds) {
markedWorker.timeout = setTimeout(function () {
markedWorker.timeout = setTimeout(function() {
seconds++;
markedWorker.onerror('Marked has taken longer than ' + seconds + ' second' + (seconds > 1 ? 's' : '') + ' to respond...');
workerTimeout(seconds);

View file

@ -1,4 +1,4 @@
/* globals marked, unfetch, ES6Promise */
/* globals marked, unfetch, ES6Promise, Promise */ // eslint-disable-line no-redeclare
if (!self.Promise) {
self.importScripts('https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js');
self.Promise = ES6Promise;
@ -11,15 +11,15 @@ if (!self.fetch) {
var versionCache = {};
var currentVersion;
onunhandledrejection = function (e) {
onunhandledrejection = function(e) {
throw e.reason;
};
onmessage = function (e) {
onmessage = function(e) {
if (e.data.version === currentVersion) {
parse(e);
} else {
loadVersion(e.data.version).then(function () {
loadVersion(e.data.version).then(function() {
parse(e);
});
}
@ -87,13 +87,13 @@ function loadVersion(ver) {
promise = Promise.resolve(versionCache[ver]);
} else {
promise = fetch(ver)
.then(function (res) { return res.text(); })
.then(function (text) {
.then(function(res) { return res.text(); })
.then(function(text) {
versionCache[ver] = text;
return text;
});
}
return promise.then(function (text) {
return promise.then(function(text) {
try {
// eslint-disable-next-line no-new-func
Function(text)();

View file

@ -148,6 +148,7 @@
<ul>
<li><a href="#/USING_ADVANCED.md#options">Options</a></li>
<li><a href="#/USING_ADVANCED.md#highlight">Highlighting</a></li>
<li><a href="#/USING_ADVANCED.md#workers">Workers</a></li>
</ul>
</li>
<li>

View file

@ -1 +0,0 @@
module.exports = require('./lib/marked');

View file

@ -1,11 +0,0 @@
{
"spec_dir": "test",
"spec_files": [
"**/*-spec.js"
],
"helpers": [
"helpers/helpers.js"
],
"stopSpecOnExpectationFailure": false,
"random": true
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@ marked \- a javascript markdown parser
.B marked
[\-o \fI<output>\fP] [\-i \fI<input>\fP] [\-\-help]
[\-\-tokens] [\-\-pedantic] [\-\-gfm]
[\-\-breaks] [\-\-tables] [\-\-sanitize]
[\-\-breaks] [\-\-sanitize]
[\-\-smart\-lists] [\-\-lang\-prefix \fI<prefix>\fP]
[\-\-no\-etc...] [\-\-silent] [\fIfilename\fP]
@ -72,9 +72,6 @@ Enable github flavored markdown.
.BI \-\-breaks
Enable GFM line breaks. Only works with the gfm option.
.TP
.BI \-\-tables
Enable GFM tables. Only works with the gfm option.
.TP
.BI \-\-sanitize
Sanitize output. Ignore any HTML input.
.TP

View file

@ -4,10 +4,10 @@ NAME
marked - a javascript markdown parser
SYNOPSIS
marked [-o <output>] [-i <input>] [--help] [--tokens]
[--pedantic] [--gfm] [--breaks] [--tables] [--sanitize]
[--smart-lists] [--lang-prefix <prefix>] [--no-etc...] [--silent]
[filename]
marked [-o <output>] [-i <input>] [--help] [--tokens] [--pedantic]
[--gfm] [--breaks] [--sanitize] [--smart-lists] [--lang-prefix <pre-
fix>] [--no-etc...] [--silent] [filename]
DESCRIPTION
marked is a full-featured javascript markdown parser, built for speed.
@ -56,9 +56,6 @@ OPTIONS
--breaks
Enable GFM line breaks. Only works with the gfm option.
--tables
Enable GFM tables. Only works with the gfm option.
--sanitize
Sanitize output. Ignore any HTML input.

File diff suppressed because one or more lines are too long

3751
packages/markdown/marked/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -2,13 +2,14 @@
"name": "marked",
"description": "A markdown parser built for speed",
"author": "Christopher Jeffrey",
"version": "0.6.2",
"main": "./lib/marked.js",
"version": "0.8.0",
"main": "./src/marked.js",
"bin": "./bin/marked",
"man": "./man/marked.1",
"files": [
"bin/",
"lib/",
"src/",
"man/",
"marked.min.js"
],
@ -29,41 +30,48 @@
"html"
],
"devDependencies": {
"@markedjs/html-differ": "^2.0.1",
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.6",
"@markedjs/html-differ": "^3.0.0",
"cheerio": "^1.0.0-rc.3",
"commonmark": "0.x",
"eslint": "^5.15.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vuln-regex-detector": "^1.0.4",
"front-matter": "^3.0.1",
"glob-to-regexp": "^0.4.0",
"jasmine": "^3.3.1",
"markdown": "0.x",
"markdown-it": "8.x",
"node-fetch": "^2.3.0",
"uglify-js": "^3.4.9"
"commonmark": "0.29.x",
"eslint": "^6.7.2",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"front-matter": "^3.0.2",
"jasmine": "^3.5.0",
"markdown": "0.5.x",
"markdown-it": "10.x",
"node-fetch": "^2.6.0",
"rollup": "^1.27.11",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-license": "^0.13.0",
"uglify-js": "^3.7.2",
"vuln-regex-detector": "^1.3.0"
},
"scripts": {
"test": "jasmine --config=jasmine.json",
"test:all": "npm test && npm run test:lint",
"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",
"test:node4": "npx node@4 ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json",
"bench": "node test --bench",
"test:redos": "node test/vuln-regex.js",
"test:update": "node test/update-specs.js",
"bench": "npm run rollup && node test/bench.js",
"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')"
"build:reset": "git checkout upstream/master lib/marked.js lib/marked.esm.js marked.min.js",
"build": "npm run rollup && npm run minify",
"rollup": "npm run rollup:umd && npm run rollup:esm",
"rollup:umd": "rollup -c rollup.config.js",
"rollup:esm": "rollup -c rollup.config.esm.js",
"minify": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
"preversion": "npm run build && (git diff --quiet || git commit -am 'build')"
},
"engines": {
"node": ">=0.10.0"
"node": ">= 8.16.2"
}
}

View file

@ -1,10 +0,0 @@
In this directory:
#
# MarkdownTester -- Run tests for Markdown implementations
#
# Copyright (c) 2004-2005 John Gruber
# <http://daringfireball.net/projects/markdown/>
#
Partially modified for testing purposes.

View file

@ -1,5 +0,0 @@
<!doctype html>
<title>marked tests</title>
<p>testing...</p>
<script src="marked.js"></script>
<script src="test.js"></script>

View file

@ -1,39 +0,0 @@
var fs = require('fs'),
path = require('path');
var testMod = require('../'),
load = testMod.load;
var express = require('express'),
app = express();
var files = load();
app.use(function(req, res, next) {
var setHeader = res.setHeader;
res.setHeader = function(name) {
switch (name) {
case 'Cache-Control':
case 'Last-Modified':
case 'ETag':
return;
}
return setHeader.apply(res, arguments);
};
next();
});
app.get('/test.js', function(req, res, next) {
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(testScript);
});
app.use(express.static(path.join(__dirname, '/../../lib')));
app.use(express.static(__dirname));
app.listen(8080);

View file

@ -1,66 +0,0 @@
;(function() {
var console = {},
files = __TESTS__; // eslint-disable-line no-undef
console.log = function(text) {
var args = Array.prototype.slice.call(arguments, 1),
i = 0;
text = text.replace(/%\w/g, function() {
return args[i++] || '';
});
if (window.console) window.console.log(text);
document.body.innerHTML += '<pre>' + escape(text) + '</pre>';
};
if (!Object.keys) {
Object.keys = function(obj) {
var out = [],
key;
for (key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
out.push(key);
}
}
return out;
};
}
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) {
// eslint-disable-next-line no-extend-native
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
}
// eslint-disable-next-line no-unused-vars
function load() {
return files;
}
function escape(html, encode) {
return html
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
__LIBS__; // eslint-disable-line no-undef, no-unused-expressions
(__MAIN__)(); // eslint-disable-line no-undef
}).call(this);

View file

@ -1,26 +0,0 @@
const marked = require('../../');
const htmlDiffer = require('./html-differ.js');
beforeEach(() => {
marked.setOptions(marked.getDefaults());
jasmine.addMatchers({
toRender: () => {
return {
compare: (spec, expected) => {
const result = {};
const actual = marked(spec.markdown, spec.options);
result.pass = htmlDiffer.isEqual(expected, actual);
if (result.pass) {
result.message = `${spec.markdown}\n------\n\nExpected: Should Fail`;
} else {
const diff = htmlDiffer.firstDiff(actual, expected);
result.message = `Expected: ${diff.expected}\n Actual: ${diff.actual}`;
}
return result;
}
};
}
});
});

View file

@ -1,38 +0,0 @@
const HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer;
const htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true});
module.exports = {
isEqual: htmlDiffer.isEqual.bind(htmlDiffer),
firstDiff: (actual, expected, padding) => {
padding = padding || 30;
const result = htmlDiffer
.diffHtml(actual, expected)
.reduce((obj, diff) => {
if (diff.added) {
if (obj.firstIndex === null) {
obj.firstIndex = obj.expected.length;
}
obj.expected += diff.value;
} else if (diff.removed) {
if (obj.firstIndex === null) {
obj.firstIndex = obj.actual.length;
}
obj.actual += diff.value;
} else {
obj.actual += diff.value;
obj.expected += diff.value;
}
return obj;
}, {
firstIndex: null,
actual: '',
expected: ''
});
return {
actual: result.actual.substring(result.firstIndex - padding, result.firstIndex + padding),
expected: result.expected.substring(result.firstIndex - padding, result.firstIndex + padding)
};
}
};

View file

@ -1,551 +0,0 @@
#!/usr/bin/env node
'use strict';
// 'use strict' is here so we can use let and const in node 4
/**
* marked tests
* Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
/**
* Modules
*/
const fs = require('fs');
const path = require('path');
const fm = require('front-matter');
const g2r = require('glob-to-regexp');
let marked = require('../');
const htmlDiffer = require('./helpers/html-differ.js');
/**
* Load Tests
*/
function load(options) {
options = options || {};
const dir = path.join(__dirname, 'compiled_tests');
const glob = g2r(options.glob || '*', { extended: true });
const list = fs
.readdirSync(dir)
.filter(file => {
return path.extname(file) === '.md';
})
.sort();
const files = list.reduce((obj, item) => {
const name = path.basename(item, '.md');
if (glob.test(name)) {
const file = path.join(dir, item);
const content = fm(fs.readFileSync(file, 'utf8'));
obj[name] = {
options: content.attributes,
text: content.body,
html: fs.readFileSync(file.replace(/[^.]+$/, 'html'), 'utf8')
};
}
return obj;
}, {});
if (options.bench || options.time) {
if (!options.glob) {
// Change certain tests to allow
// comparison to older benchmark times.
fs.readdirSync(path.join(__dirname, 'new')).forEach(name => {
if (path.extname(name) === '.html') return;
if (name === 'main.md') return;
delete files[name];
});
}
if (files['backslash_escapes.md']) {
files['backslash_escapes.md'] = {
text: 'hello world \\[how](are you) today'
};
}
if (files['main.md']) {
files['main.md'].text = files['main.md'].text.replace('* * *\n\n', '');
}
}
return files;
}
/**
* Test Runner
*/
function runTests(engine, options) {
if (typeof engine !== 'function') {
options = engine;
engine = null;
}
engine = engine || marked;
options = options || {};
let succeeded = 0;
let failed = 0;
const files = options.files || load(options);
const filenames = Object.keys(files);
if (options.marked) {
marked.setOptions(options.marked);
}
for (let i = 0; i < filenames.length; i++) {
const filename = filenames[i];
const file = files[filename];
const success = testFile(engine, file, filename, i + 1);
if (success) {
succeeded++;
} else {
failed++;
if (options.stop) {
break;
}
}
}
console.log('\n%d/%d tests completed successfully.', succeeded, filenames.length);
if (failed) console.log('%d/%d tests failed.', failed, filenames.length);
return !failed;
}
/**
* Test a file
*/
function testFile(engine, file, filename, index) {
const opts = Object.keys(file.options);
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(key => {
marked.defaults[key] = marked._original[key];
});
opts.forEach(key => {
if (marked.defaults.hasOwnProperty(key)) {
marked.defaults[key] = file.options[key];
}
});
}
const before = process.hrtime();
let text, html, elapsed;
try {
text = engine(file.text);
html = file.html;
} catch (e) {
elapsed = process.hrtime(before);
console.log('\n failed in %dms\n', prettyElapsedTime(elapsed));
throw e;
}
elapsed = process.hrtime(before);
if (htmlDiffer.isEqual(text, html)) {
if (elapsed[0] > 0) {
console.log('\n failed because it took too long.\n\n passed in %dms\n', prettyElapsedTime(elapsed));
return false;
}
console.log(' passed in %dms', prettyElapsedTime(elapsed));
return true;
}
const diff = htmlDiffer.firstDiff(text, html);
console.log('\n failed in %dms', prettyElapsedTime(elapsed));
console.log(' Expected: %s', diff.expected);
console.log(' Actual: %s\n', diff.actual);
return false;
}
/**
* Benchmark a function
*/
function bench(name, files, engine) {
const start = Date.now();
for (let i = 0; i < 1000; i++) {
for (const filename in files) {
engine(files[filename].text);
}
}
const end = Date.now();
console.log('%s completed in %dms.', name, end - start);
}
/**
* Benchmark all engines
*/
function runBench(options) {
options = options || {};
const files = load(options);
// Non-GFM, Non-pedantic
marked.setOptions({
gfm: false,
tables: false,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: false
});
if (options.marked) {
marked.setOptions(options.marked);
}
bench('marked', files, marked);
// GFM
marked.setOptions({
gfm: true,
tables: false,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: false
});
if (options.marked) {
marked.setOptions(options.marked);
}
bench('marked (gfm)', files, marked);
// Pedantic
marked.setOptions({
gfm: false,
tables: false,
breaks: false,
pedantic: true,
sanitize: false,
smartLists: false
});
if (options.marked) {
marked.setOptions(options.marked);
}
bench('marked (pedantic)', files, marked);
try {
bench('commonmark', files, (() => {
const commonmark = require('commonmark');
const parser = new commonmark.Parser();
const writer = new commonmark.HtmlRenderer();
return function (text) {
return writer.render(parser.parse(text));
};
})());
} catch (e) {
console.log('Could not bench commonmark. (Error: %s)', e.message);
}
try {
bench('markdown-it', files, (() => {
const MarkdownIt = require('markdown-it');
const md = new MarkdownIt();
return md.render.bind(md);
})());
} catch (e) {
console.log('Could not bench markdown-it. (Error: %s)', e.message);
}
try {
bench('markdown.js', files, (() => {
const markdown = require('markdown').markdown;
return markdown.toHTML.bind(markdown);
})());
} catch (e) {
console.log('Could not bench markdown.js. (Error: %s)', e.message);
}
return true;
}
/**
* A simple one-time benchmark
*/
function time(options) {
options = options || {};
const files = load(options);
if (options.marked) {
marked.setOptions(options.marked);
}
bench('marked', files, marked);
return true;
}
/**
* Markdown Test Suite Fixer
* This function is responsible for "fixing"
* the markdown test suite. There are
* certain aspects of the suite that
* are strange or might make tests
* fail for reasons unrelated to
* conformance.
*/
function fix() {
['compiled_tests', 'original', 'new', 'redos'].forEach(dir => {
try {
fs.mkdirSync(path.resolve(__dirname, dir));
} catch (e) {
// directory already exists
}
});
// rm -rf tests
fs.readdirSync(path.resolve(__dirname, 'compiled_tests')).forEach(file => {
fs.unlinkSync(path.resolve(__dirname, 'compiled_tests', file));
});
// cp -r original tests
fs.readdirSync(path.resolve(__dirname, 'original')).forEach(file => {
let text = fs.readFileSync(path.resolve(__dirname, 'original', file), 'utf8');
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
const dir = path.join(__dirname, 'compiled_tests');
fs.readdirSync(dir).filter(file => {
return path.extname(file) === '.html';
}).forEach(file => {
file = path.join(dir, file);
let html = fs.readFileSync(file, 'utf8');
// fix unencoded quotes
html = html
.replace(/='([^\n']*)'(?=[^<>\n]*>)/g, '=&__APOS__;$1&__APOS__;')
.replace(/="([^\n"]*)"(?=[^<>\n]*>)/g, '=&__QUOT__;$1&__QUOT__;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/&__QUOT__;/g, '"')
.replace(/&__APOS__;/g, '\'');
fs.writeFileSync(file, html);
});
// turn <hr /> into <hr>
fs.readdirSync(dir).forEach(file => {
file = path.join(dir, file);
let text = fs.readFileSync(file, 'utf8');
text = text.replace(/(<|&lt;)hr\s*\/(>|&gt;)/g, '$1hr$2');
fs.writeFileSync(file, text);
});
// markdown does some strange things.
// it does not encode naked `>`, marked does.
{
const file = `${dir}/amps_and_angles_encoding.html`;
const html = fs.readFileSync(file, 'utf8')
.replace('6 > 5.', '6 &gt; 5.');
fs.writeFileSync(file, html);
}
// cp new/* tests/
fs.readdirSync(path.resolve(__dirname, 'new')).forEach(file => {
fs.writeFileSync(path.resolve(__dirname, 'compiled_tests', file),
fs.readFileSync(path.resolve(__dirname, 'new', file)));
});
// cp redos/* tests/
fs.readdirSync(path.resolve(__dirname, 'redos')).forEach(file => {
fs.writeFileSync(path.resolve(__dirname, 'compiled_tests', file),
fs.readFileSync(path.resolve(__dirname, 'redos', file)));
});
}
/**
* Argument Parsing
*/
function parseArg(argv) {
argv = argv.slice(2);
const options = {};
const orphans = [];
function getarg() {
let arg = argv.shift();
if (arg.indexOf('--') === 0) {
// e.g. --opt
arg = arg.split('=');
if (arg.length > 1) {
// e.g. --opt=val
argv.unshift(arg.slice(1).join('='));
}
arg = arg[0];
} else if (arg[0] === '-') {
if (arg.length > 2) {
// e.g. -abc
argv = arg.substring(1).split('').map(ch => {
return `-${ch}`;
}).concat(argv);
arg = argv.shift();
} else {
// e.g. -a
}
} else {
// e.g. foo
}
return arg;
}
while (argv.length) {
let arg = getarg();
switch (arg) {
case '-f':
case '--fix':
case 'fix':
if (options.fix !== false) {
options.fix = true;
}
break;
case '--no-fix':
case 'no-fix':
options.fix = false;
break;
case '-b':
case '--bench':
options.bench = true;
break;
case '-s':
case '--stop':
options.stop = true;
break;
case '-t':
case '--time':
options.time = true;
break;
case '-m':
case '--minified':
options.minified = true;
break;
case '--glob':
arg = argv.shift();
options.glob = arg.replace(/^=/, '');
break;
default:
if (arg.indexOf('--') === 0) {
const opt = camelize(arg.replace(/^--(no-)?/, ''));
if (!marked.defaults.hasOwnProperty(opt)) {
continue;
}
options.marked = options.marked || {};
if (arg.indexOf('--no-') === 0) {
options.marked[opt] = typeof marked.defaults[opt] !== 'boolean'
? null
: false;
} else {
options.marked[opt] = typeof marked.defaults[opt] !== 'boolean'
? argv.shift()
: true;
}
} else {
orphans.push(arg);
}
break;
}
}
return options;
}
/**
* Helpers
*/
function camelize(text) {
return text.replace(/(\w)-(\w)/g, (_, a, b) => a + b.toUpperCase());
}
/**
* Main
*/
function main(argv) {
const opt = parseArg(argv);
if (opt.fix !== false) {
fix();
}
if (opt.fix) {
// only run fix
return;
}
if (opt.bench) {
return runBench(opt);
}
if (opt.time) {
return time(opt);
}
if (opt.minified) {
marked = require('../marked.min.js');
}
return runTests(opt);
}
/**
* Execute
*/
if (!module.parent) {
process.title = 'marked';
process.exit(main(process.argv.slice()) ? 0 : 1);
} else {
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) {
const seconds = hrtimeElapsed[0];
const frac = Math.round(hrtimeElapsed[1] / 1e3) / 1e3;
return seconds * 1e3 + frac;
}

View file

@ -1,62 +0,0 @@
const path = require('path');
const fs = require('fs');
const folder = process.argv[2];
const jsonFile = process.argv[3];
if (!folder || !jsonFile) {
console.log('node ./json-to-files.js {path to folder} {path to json file}');
process.exit(1);
}
const specs = require(jsonFile);
const files = specs.reduce((obj, spec) => {
if (!obj[spec.section]) {
obj[spec.section] = {
md: [],
html: [],
options: {}
};
}
obj[spec.section].md.push(spec.markdown);
obj[spec.section].html.push(spec.html);
Object.assign(obj[spec.section].options, spec.options);
return obj;
}, {});
try {
fs.mkdirSync(folder, {recursive: true});
} catch (ex) {
// already exists
}
for (const section in files) {
const file = files[section];
const name = section.toLowerCase().replace(' ', '_');
const frontMatter = Object.keys(file.options).map(opt => {
let value = file.options[opt];
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
return `${opt}: ${value}`;
}).join('\n');
let markdown = file.md.join('\n\n');
if (frontMatter) {
markdown = `---\n${frontMatter}\n---\n\n${markdown}`;
}
const html = file.html.join('\n\n');
const mdFile = path.resolve(folder, `${name}.md`);
const htmlFile = path.resolve(folder, `${name}.html`);
if (fs.existsSync(mdFile) || fs.existsSync(htmlFile)) {
throw new Error(`${name} already exists.`);
}
fs.writeFileSync(mdFile, markdown);
fs.writeFileSync(htmlFile, html);
}

View file

@ -1,9 +0,0 @@
<ul>
<li>This should be</li>
<li>An unordered list</li>
</ul>
<ol>
<li>This should be</li>
<li>An unordered list</li>
</ol>

View file

@ -1,5 +0,0 @@
* This should be
* An unordered list
1. This should be
2. An unordered list

View file

@ -1,3 +0,0 @@
<p>hello world
<a href="http://example.com">http://example.com</a>
</p>

View file

@ -1,2 +0,0 @@
hello world
<http://example.com>

View file

@ -1,15 +0,0 @@
<p>(See <a href="https://www.example.com/fhqwhgads">https://www.example.com/fhqwhgads</a>.)</p>
<p>((<a href="http://foo.com">http://foo.com</a>))</p>
<p>((<a href="http://foo.com">http://foo.com</a>.))</p>
<p><a href="HTTP://FOO.COM">HTTP://FOO.COM</a></p>
<p><a href="hTtP://fOo.CoM">hTtP://fOo.CoM</a></p>
<p><del><a href="mailto:hello@email.com">hello@email.com</a></del></p>
<p><strong><a href="mailto:me@example.com">me@example.com</a></strong></p>
<p><strong><a href="mailto:test@test.com">test@test.com</a></strong></p>

View file

@ -1,15 +0,0 @@
(See https://www.example.com/fhqwhgads.)
((http://foo.com))
((http://foo.com.))
HTTP://FOO.COM
hTtP://fOo.CoM
~~hello@email.com~~
**me@example.com**
__test@test.com__

View file

@ -1,3 +0,0 @@
<p>This fails in markdown.pl and upskirt:</p>
<ul><li>hello<blockquote><p>world</p></blockquote></li></ul>

View file

@ -1,4 +0,0 @@
This fails in markdown.pl and upskirt:
* hello
> world

View file

@ -1 +0,0 @@
<p><a href="/url">hi</a></p>

View file

@ -1,3 +0,0 @@
[hi]
[HI]: /url

View file

@ -1,91 +0,0 @@
<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&amp;id=22&amp;boolean">http://foo.bar.baz/test?q=hello&amp;id=22&amp;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>&lt;http://foo.bar/baz bim&gt;</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>&lt;foo+@bar.example.com&gt;</p>
<p>These are not autolinks:</p>
<h3 id="example-578">Example 578</h3>
<p>&lt;&gt;</p>
<h3 id="example-579">Example 579</h3>
<p>&lt; http://foo.bar &gt;</p>
<h3 id="example-580">Example 580</h3>
<p>&lt;m:abc&gt;</p>
<h3 id="example-581">Example 581</h3>
<p>&lt;foo.bar.baz&gt;</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>

View file

@ -1,96 +0,0 @@
---
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

View file

@ -1,233 +0,0 @@
<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>&gt;</code> characters can be omitted:</p>
<blockquote>
<h1 id="bar">Bar</h1>
<p>bar
baz</p>
</blockquote>
<h3 id="example-193">Example 193</h3>
<p>The <code>&gt;</code> characters can be indented 1-3 spaces:</p>
<blockquote>
<h1 id="baz">Baz</h1>
<p>bar
baz</p>
</blockquote>
<h3 id="example-194">Example 194</h3>
<p>Four spaces gives us a code block:</p>
<pre><code>&gt; # Qux
&gt; bar
&gt; baz</code></pre>
<h3 id="example-195">Example 195</h3>
<p>The Laziness clause allows us to omit the <code>&gt;</code> before paragraph continuation text:</p>
<blockquote>
<h1 id="quux">Quux</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>&gt;</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 `&gt;` in the second line then the block quote ends after the first line:
&gt; - foo
- bar</code></pre>
<h3 id="example-199">Example 199</h3>
<p>For the same reason, we cant omit the <code>&gt;</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>&gt; ```
foo
```
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;foo&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;</code></pre>
<h3 id="example-201">Example 201</h3>
<pre><code>&gt; foo
- bar
&lt;blockquote&gt;
&lt;p&gt;foo
- bar&lt;/p&gt;
&lt;/blockquote&gt;</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>&gt;</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>&gt;</code> and a following space. So five spaces are needed after the <code>&gt;</code>:</p>
<blockquote>
<pre><code>code</code></pre>
</blockquote>
<blockquote>
<p>not code</p>
</blockquote>

View file

@ -1,189 +0,0 @@
### Example 191
> # Foo
> bar
> baz
### Example 192
The spaces after the `>` characters can be omitted:
># Bar
>bar
> baz
### Example 193
The `>` characters can be indented 1-3 spaces:
> # Baz
> bar
> baz
### Example 194
Four spaces gives us a code block:
> # Qux
> bar
> baz
### Example 195
The Laziness clause allows us to omit the `>` before paragraph continuation text:
> # Quux
> 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 cant 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

View file

@ -1,300 +0,0 @@
<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>&lt;!-- foo --&gt;
</code></pre>
<h3 id="example-151">Example 151</h3>
<div>
<pre><code>&lt;div&gt;
</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>&lt;td&gt;
Hi
&lt;/td&gt;
</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

View file

@ -1,312 +0,0 @@
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

View file

@ -1,115 +0,0 @@
<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 &#39;title</p>
<p>with blank line&#39;</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 &quot;foo\&quot;bar\baz&quot;
[foo167]
should render to
&lt;p&gt;&lt;a href=&quot;/url%5Cbar*baz&quot; title=&quot;foo&amp;quot;bar\baz&quot;&gt;foo167&lt;/a&gt;&lt;/p&gt;</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 &quot;title&quot; ok</p>
<h3 id="example-175">Example 175</h3>
<p>&quot;title&quot; ok</p>
<h3 id="example-176">Example 176</h3>
<pre><code>[foo176]: /url &quot;title&quot;
</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>

View file

@ -1,157 +0,0 @@
### 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&quot;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

View file

@ -1,397 +0,0 @@
<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](&lt;/my uri&gt;)</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 &lt;...&gt; 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&auml;">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 &quot;&quot;">link</a></p>
<h3 id="example-479">Example 479</h3>
<p>[link](/url &quot;title &quot;and&quot; title&quot;)</p>
<h3 id="example-480">Example 480</h3>
<p><a href="/url" title="title &quot;and&quot; 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 &amp; tracks" /></p>
<h3 id="example-5450">Example 5450</h3>
<p><img src="/url2" alt="foo ![bar](/url)" /></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 &amp; tracks" /></p>
<h3 id="example-5480">Example 5480</h3>
<p><img src="train.jpg" alt="foo *bar*" title="train &amp; 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 &quot;title&quot;</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>

View file

@ -1,515 +0,0 @@
---
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&auml;)
### Example 475
[link]("title")
### Example 476
[link](/url "title")
[link](/url 'title')
[link](/url (title))
### Example 477
[link](/url "title \"&quot;")
### 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
[![moon](moon.jpg)](/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
[![moon](moon.jpg)][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
![foo543](/url "title")
### Example 5440
![foo *bar*544]
[foo *bar*544]: train.jpg "train & tracks"
### Example 5450
![foo ![bar](/url)](/url2)
### Example 5460
![foo [bar](/url)](/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
![foo](train.jpg)
### Example 550
My ![foo bar](/path/to/train.jpg "title" )
### Example 551
![foo](<url>)
### Example 552
![](/url)
### 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"

View file

@ -1,77 +0,0 @@
<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>&lt;33&gt; &lt;__&gt;</p>
<h3 id="example-590">Example 590</h3>
<p>&lt;a h*#ref=&quot;hi&quot;&gt;</p>
<h3 id="example-591">Example 591</h3>
<p>&lt;a href=&quot;hi&#39;&gt; &lt;a href=hi&#39;&gt;</p>
<h3 id="example-592">Example 592</h3>
<p>&lt; a&gt;&lt;
foo&gt;&lt;bar/ &gt;</p>
<h3 id="example-593">Example 593</h3>
<p>&lt;a href=&#39;bar&#39;title=title&gt;</p>
<h3 id="example-594">Example 594</h3>
<p></a></foo ></p>
<h3 id="example-595">Example 595</h3>
<p>&lt;/a href=&quot;foo&quot;&gt;</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="&ouml;"></p>
<h3 id="example-603">Example 603</h3>
<p>foo <a href="\*"></p>

View file

@ -1,78 +0,0 @@
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="&ouml;">
### Example 603
foo <a href="\*">

View file

@ -1,7 +0,0 @@
<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>
<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>
<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>
<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>

View file

@ -1,7 +0,0 @@
So *a* single *word* followed *b*y *a*nother
So **a** single **word** followed **b**y **a**nother
So _a_ single _word_ followed _b_y _a_nother
So __a__ single __word__ followed __b__y __a__nother

View file

@ -1,106 +0,0 @@
<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>

View file

@ -1,98 +0,0 @@
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
- * * *

View file

@ -1,3 +0,0 @@
<p><code>someone@example.com</code></p>
<p>``<em>test`</em></p>

View file

@ -1,3 +0,0 @@
`someone@example.com`
``*test`*

View file

@ -1,30 +0,0 @@
<blockquote>
<p>hello
[1]: hello</p>
</blockquote>
<hr>
<blockquote>
<p>hello
[2]: hello</p>
</blockquote>
<ul>
<li>hello</li>
<li>[3]: hello</li>
</ul>
<ul>
<li>hello</li>
</ul>
<blockquote>
<p>foo
bar
[5]: foo
bar</p>
</blockquote>

View file

@ -1,21 +0,0 @@
> hello
> [1]: hello
* * *
> hello
[2]: hello
* hello
* [3]: hello
* hello
[4]: hello
> foo
> bar
[5]: foo
> bar

View file

@ -1,5 +0,0 @@
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
<p>Already linked: <a href="http://example.com/"><strong>http://example.com/</strong></a>.</p>

View file

@ -1,5 +0,0 @@
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
Already linked: [http://example.com/](http://example.com/).
Already linked: <a href="http://example.com/">**http://example.com/**</a>.

View file

@ -1,25 +0,0 @@
<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>

View file

@ -1,25 +0,0 @@
_123_
*123*
_12_
*12*
_1_
*1*
__
**
_123 _
*123 *
_ 123_
_1__
*1**

View file

@ -1 +0,0 @@
<p><em>test</em>. <em>test</em>: <em>test</em>! <em>test</em>? <em>test</em>-</p>

View file

@ -1 +0,0 @@
_test_. _test_: _test_! _test_? _test_-

View file

@ -1 +0,0 @@
<p>&gt;</p>

View file

@ -1,83 +0,0 @@
<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-&lt; 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&amp;hl=en">www.google.com/search?q=commonmark&amp;hl=en</a></p>
<p><a href="http://www.google.com/search?q=commonmark">www.google.com/search?q=commonmark</a>&amp;</p>
<h3 id="example-603">Example 603</h3>
<p>&lt; immediately ends an autolink.</p>
<p><a href="http://www.commonmark.org/he">www.commonmark.org/he</a>&lt;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&#39;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>

View file

@ -1,83 +0,0 @@
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&amp;
### 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_

View file

@ -1 +0,0 @@
<p>Look at the<br>pretty line<br>breaks.</p>

View file

@ -1,6 +0,0 @@
---
breaks: true
---
Look at the
pretty line
breaks.

View file

@ -1,21 +0,0 @@
<pre><code class="language-js">var a = &#39;hello&#39;;
console.log(a + &#39; world&#39;);</code></pre>
<pre><code class="language-bash">echo &quot;hello, ${WORLD}&quot;</code></pre>
<pre><code class="language-longfence">Q: What do you call a tall person who sells stolen goods?</code></pre>
<pre><code class="language-ManyTildes">A longfence!</code></pre>
<p>How about an empty code block?</p>
<pre><code class="language-js"></code></pre>
<p>How about a code block with only an empty line?</p>
<pre><code class="language-js">
</code></pre>
<p>With some trailing empty lines:</p>
<pre><code>ciao
</code></pre>
<p>Closing fences must lay on a new line:</p>
<pre><code>hello()
^```
&quot;this should still be in the code block!&quot;</code></pre>

View file

@ -1,43 +0,0 @@
``` js
var a = 'hello';
console.log(a + ' world');
```
~~~bash
echo "hello, ${WORLD}"
~~~
```````longfence
Q: What do you call a tall person who sells stolen goods?
```````
~~~~~~~~~~ ManyTildes
A longfence!
~~~~~~~~~~
How about an empty code block?
```js
```
How about a code block with only an empty line?
```js
```
With some trailing empty lines:
```
ciao
```
Closing fences must lay on a new line:
```
hello()
^```
"this should still be in the code block!"
```

View file

@ -1,52 +0,0 @@
<h2 id="foo">foo</h2>
<ol>
<li><p>bar:</p>
<blockquote>
<ul>
<li>one<ul>
<li>two<ul>
<li>three</li>
<li>four</li>
<li>five</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
</li>
<li><p>foo:</p>
<pre><code> line 1
line 2</code></pre>
</li>
<li><p>foo:</p>
<ol>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="language-erb"> some code here
</code></pre>
</li>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="language-erb"> foo
---
bar
---
foo
bar</code></pre>
</li>
<li><p>foo <code>bar</code> bar:</p>
<pre><code class="language-html"> ---
foo
foo
---
bar</code></pre>
</li>
<li><p>foo <code>bar</code> bar:</p>
<pre><code> foo
---
bar</code></pre>
</li>
<li><p>foo</p>
</li>
</ol>
</li>
</ol>

View file

@ -1,53 +0,0 @@
## foo
1. bar:
> - one
- two
- three
- four
- five
1. foo:
```
line 1
line 2
```
1. foo:
1. foo `bar` bar:
``` erb
some code here
```
2. foo `bar` bar:
``` erb
foo
---
bar
---
foo
bar
```
3. foo `bar` bar:
``` html
---
foo
foo
---
bar
```
4. foo `bar` bar:
foo
---
bar
5. foo

View file

@ -1 +0,0 @@
<p>These words should_not_be_emphasized.</p>

View file

@ -1 +0,0 @@
These words should_not_be_emphasized.

View file

@ -1,5 +0,0 @@
<p>#header</p>
<h1 id="header1">header1</h1>
<h1 id="header2">header2</h1>

View file

@ -1,8 +0,0 @@
---
gfm: true
---
#header
# header1
# header2

View file

@ -1 +0,0 @@
<p>This should not be linked: http://example.com/%ff</p>

View file

@ -1,4 +0,0 @@
---
sanitize: true
---
This should not be linked: http://example.com/%ff

View file

@ -1,37 +0,0 @@
<table>
<thead>
<tr><th>Heading 1</th><th>Heading 2</th></tr>
</thead>
<tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
<tr><td>Cell 3</td><td>Cell 4</td></tr>
</tbody>
</table>
<table>
<thead>
<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 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>
<table>
<thead>
<tr><th>Header 1</th><th>Header 2</th></tr>
</thead>
<tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
<tr><td>Cell 3</td><td>Cell 4</td></tr>
</tbody>
</table>
<table>
<thead>
<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 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>

View file

@ -1,21 +0,0 @@
| Heading 1 | Heading 2
| --------- | ---------
| Cell 1 | Cell 2
| Cell 3 | Cell 4
| Header 1 | Header 2 | Header 3 | Header 4 |
| :------: | -------: | :------- | -------- |
| Cell 1 | Cell 2 | Cell 3 | Cell 4 |
| Cell 5 | Cell 6 | Cell 7 | Cell 8 |
Test code
Header 1 | Header 2
-------- | --------
Cell 1 | Cell 2
Cell 3 | Cell 4
Header 1|Header 2|Header 3|Header 4
:-------|:------:|-------:|--------
Cell 1 |Cell 2 |Cell 3 |Cell 4
*Cell 5*|Cell 6 |Cell 7 |Cell 8

Some files were not shown because too many files have changed in this diff Show more