Browse Source

Changed project name, links, attribution & updated constructor call

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
9afffbaefd
  1. 7
      CHANGELOG.md
  2. 3
      CONTRIBUTING.md
  3. 2
      LICENSE
  4. 10
      Makefile
  5. 105
      README.md
  6. 3
      benchmark/implementations/current-commonmark/index.js
  7. 3
      benchmark/implementations/current/index.js
  8. 2
      benchmark/implementations/marked-0.3.2/index.js
  9. 3
      benchmark/profile.js
  10. 4
      benchmark/samples/lorem1.txt
  11. 5
      bin/markdown-it.js
  12. 6
      bower.json
  13. 8
      demo/assets/index.js
  14. 22
      demo/index.html
  15. 10
      demo/index.jade
  16. 7
      demo/sample.js
  17. 2
      demo/sample.md
  18. 32
      dist/markdown-it.js
  19. 4
      dist/markdown-it.min.js
  20. 4
      dist/remarkable.min.js
  21. 2
      lib/configs/default.js
  22. 2
      lib/configs/full.js
  23. 26
      lib/index.js
  24. 16
      package.json
  25. 4
      support/specsplit.js
  26. 3
      test/commonmark.js
  27. 0
      test/fixtures/markdown-it/abbr.txt
  28. 0
      test/fixtures/markdown-it/commonmark_extras.txt
  29. 0
      test/fixtures/markdown-it/deflist.txt
  30. 0
      test/fixtures/markdown-it/del.txt
  31. 0
      test/fixtures/markdown-it/footnotes.txt
  32. 0
      test/fixtures/markdown-it/ins.txt
  33. 0
      test/fixtures/markdown-it/linkify.txt
  34. 0
      test/fixtures/markdown-it/mark.txt
  35. 0
      test/fixtures/markdown-it/proto.txt
  36. 0
      test/fixtures/markdown-it/smartquotes.txt
  37. 0
      test/fixtures/markdown-it/sub.txt
  38. 0
      test/fixtures/markdown-it/sup.txt
  39. 0
      test/fixtures/markdown-it/tables.txt
  40. 16
      test/fixtures/markdown-it/typographer.txt
  41. 0
      test/fixtures/markdown-it/xss.txt
  42. 7
      test/markdown-it.js
  43. 30
      test/misc.js

7
CHANGELOG.md

@ -1,3 +1,10 @@
2.0.0 / 2014-12-20
------------------
- New project name & home! Now it's `markdown-it`,
- Sugar for constructor call - `new` is not mandatory now.
1.5.0 / 2014-12-12 1.5.0 / 2014-12-12
------------------ ------------------

3
CONTRIBUTING.md

@ -1,6 +1,5 @@
If you commit change to Remarked: If you commit changes:
1. Make sure all tests pass. 1. Make sure all tests pass.
2. Run benchmark, make sure that performance not degraded. 2. Run benchmark, make sure that performance not degraded.
3. DON'T include auto-generated browser & demo files to commit. 3. DON'T include auto-generated browser & demo files to commit.
4. Commit to the [dev](https://github.com/jonschlinkert/remarkable/tree/dev) branch, not master.

2
LICENSE

@ -1,4 +1,4 @@
Copyright (c) 2014 Jon Schlinkert, Vitaly Puzrin. Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin.
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation

10
Makefile

@ -9,7 +9,7 @@ REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url) REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master) CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master)
GITHUB_PROJ := https://github.com//jonschlinkert/${NPM_PACKAGE} GITHUB_PROJ := https://github.com//markdown-it/${NPM_PACKAGE}
demo: lint demo: lint
@ -61,12 +61,12 @@ browserify:
mkdir dist mkdir dist
# Browserify # Browserify
( printf "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" ; \ ( printf "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" ; \
browserify -r ./ -s Remarkable \ browserify -r ./ -s markdownit \
) > dist/remarkable.js ) > dist/markdown-it.js
# Minify # Minify
uglifyjs dist/remarkable.js -c -m \ uglifyjs dist/markdown-it.js -c -m \
--preamble "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" \ --preamble "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" \
> dist/remarkable.min.js > dist/markdown-it.min.js
todo: todo:
grep 'TODO' -n -r ./lib 2>/dev/null || test true grep 'TODO' -n -r ./lib 2>/dev/null || test true

105
README.md

@ -1,53 +1,58 @@
# remarkable # markdown-it
[![Build Status](https://travis-ci.org/jonschlinkert/remarkable.svg?branch=master)](https://travis-ci.org/jonschlinkert/remarkable) [![Build Status](https://travis-ci.org/markdown-it/markdown-it.svg?branch=master)](https://travis-ci.org/markdown-it/markdown-it)
[![NPM version](https://img.shields.io/npm/v/remarkable.svg)](https://www.npmjs.org/package/remarkable) [![NPM version](https://img.shields.io/npm/v/markdown-it.svg)](https://www.npmjs.org/package/markdown-it)
[![Coverage Status](https://img.shields.io/coveralls/jonschlinkert/remarkable.svg)](https://coveralls.io/r/jonschlinkert/remarkable?branch=dev) [![Coverage Status](https://img.shields.io/coveralls/markdown-it/markdown-it.svg)](https://coveralls.io/r/markdown-it/markdown-it?branch=dev)
> Markdown parser done right. Fast and easy to extend. > Markdown parser done right. Fast and easy to extend.
__[Live demo](http://jonschlinkert.github.io/remarkable/demo/)__ __[Live demo](http://markdown-it.github.io/markdown-it/demo/)__
- Supports the [CommonMark](http://commonmark.org/) spec + - Supports the [CommonMark](http://commonmark.org/) spec +
[syntax extensions](#syntax-extensions) + sugar (URL autolinking, typographer). [syntax extensions](#syntax-extensions) + sugar (URL autolinking, typographer).
- Configurable syntax! You can add new rules and even replace existing ones. - Configurable syntax! You can add new rules and even replace existing ones.
- [High speed](#benchmark)! - [High speed](#benchmark)!
- [Community plugins](https://www.npmjs.org/browse/keyword/remarkable-plugin) on npm. - [Community plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin) on npm.
## Install ## Install
**node.js:** **node.js** & **bower**:
```bash ```bash
npm install remarkable --save npm install markdown-it --save
``` bower install markdown-it --save
**bower:**
```bash
bower install remarkable --save
``` ```
**browser (CDN):** **browser (CDN):**
- [jsDeliver CDN](http://www.jsdelivr.com/#!remarkable "jsDelivr CDN") - [jsDeliver CDN](http://www.jsdelivr.com/#!markdown-it "jsDelivr CDN")
## Usage ## Usage
```js ```js
var Remarkable = require('remarkable'); // Sugar notation
var md = new Remarkable(); var md = require('markdown-it')();
// Or honestly as class:
//
// var MarkdownIt = require('markdown-it');
// var md = new MarkdownIt();
console.log(md.render('# Remarkable rulezz!')); console.log(md.render('# markdown-it rulezz!'));
// => <h1>Remarkable rulezz!</h1> // => <h1>markdown-it rulezz!</h1>
```
In browser, when loaded global (without require.js):
```js
var md = window.markdownit();
``` ```
### Options ### Options
By default remarkable is configured to be similar to GFM, but with HTML disabled. By default markdown-it is configured to be similar to GFM, but with HTML disabled.
This is easy to change if you prefer to use different settings. This is easy to change if you prefer to use different settings.
There are two ways to define options. There are two ways to define options.
@ -58,7 +63,7 @@ Define options in the constructor:
```js ```js
// Actual default values // Actual default values
var md = new Remarkable({ var md = require('markdown-it')({
html: false, // Enable HTML tags in source html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />) xhtmlOut: false, // Use '/' to close single tags (<br />)
breaks: false, // Convert '\n' in paragraphs into <br> breaks: false, // Convert '\n' in paragraphs into <br>
@ -77,8 +82,8 @@ var md = new Remarkable({
highlight: function (/*str, lang*/) { return ''; } highlight: function (/*str, lang*/) { return ''; }
}); });
console.log(md.render('# Remarkable rulezz!')); console.log(md.render('# markdown-it rulezz!'));
// => <h1>Remarkable rulezz!</h1> // => <h1>markdown-it rulezz!</h1>
``` ```
#### .set #### .set
@ -86,8 +91,7 @@ console.log(md.render('# Remarkable rulezz!'));
Or define options via the `.set()` method: Or define options via the `.set()` method:
```js ```js
var Remarkable = require('remarkable'); var md = require('markdown-it')();
var md = new Remarkable();
md.set({ md.set({
html: true, html: true,
@ -95,7 +99,7 @@ md.set({
}); });
``` ```
**Note:** To achieve the best possible performance, don't modify a `Remarkable` **Note:** To achieve the best possible performance, don't modify a `markdown-it`
instance on the fly. If you need multiple configurations it's best to create instance on the fly. If you need multiple configurations it's best to create
multiple instances and initialize each with a configuration that is ideal for multiple instances and initialize each with a configuration that is ideal for
that instance. that instance.
@ -103,7 +107,7 @@ that instance.
### Presets ### Presets
Remarkable offers some "presets" as a convenience to quickly enable/disable `markdown-it` offers some "presets" as a convenience to quickly enable/disable
active syntax rules and options for common use cases. active syntax rules and options for common use cases.
#### commonmark #### commonmark
@ -111,8 +115,7 @@ active syntax rules and options for common use cases.
Enable strict [CommonMark](http://commonmark.org/) mode with the `commonmark` preset: Enable strict [CommonMark](http://commonmark.org/) mode with the `commonmark` preset:
```js ```js
var Remarkable = require('remarkable'); var md = require('markdown-it')('commonmark');
var md = new Remarkable('commonmark');
``` ```
#### full #### full
@ -120,11 +123,10 @@ var md = new Remarkable('commonmark');
Enable all available rules (but still with default options, if not set): Enable all available rules (but still with default options, if not set):
```js ```js
var Remarkable = require('remarkable'); var md = require('markdown-it')('full');
var md = new Remarkable('full');
// Or with options: // Or with options:
var md = new Remarkable('full', { var md = require('markdown-it')('full', {
html: true, html: true,
linkify: true, linkify: true,
typographer: true typographer: true
@ -137,11 +139,10 @@ var md = new Remarkable('full', {
Apply syntax highlighting to fenced code blocks with the `highlight` option: Apply syntax highlighting to fenced code blocks with the `highlight` option:
```js ```js
var Remarkable = require('remarkable');
var hljs = require('highlight.js') // https://highlightjs.org/ var hljs = require('highlight.js') // https://highlightjs.org/
// Actual default values // Actual default values
var md = new Remarkable({ var md = require('markdown-it')({
highlight: function (str, lang) { highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) { if (lang && hljs.getLanguage(lang)) {
try { try {
@ -184,12 +185,12 @@ old-style rules via external plugins if you prefer.
### Manage rules ### Manage rules
```js ```js
var md = new Remarkable(); var md = require('markdown-it')();
md.inline.ruler.enable([ 'ins', 'mark' ]); md.inline.ruler.enable([ 'ins', 'mark' ]);
md.block.ruler.disable([ 'table' ]); md.block.ruler.disable([ 'table' ]);
// Enable everything // Enable everything
md = new Remarkable('full', { md = require('markdown-it')('full', {
html: true, html: true,
linkify: true, linkify: true,
typographer: true, typographer: true,
@ -198,7 +199,7 @@ md = new Remarkable('full', {
// //
// Manually enable rules, disabled by default: // Manually enable rules, disabled by default:
// //
var md = new Remarkable(); var md = require('markdown-it')();
md.block.ruler.core([ md.block.ruler.core([
'abbr' 'abbr'
]); ]);
@ -218,12 +219,11 @@ md.block.ruler.enable([
### Typographer ### Typographer
Although full-weight typographical replacements are language specific, `remarkable` Although full-weight typographical replacements are language specific, `markdown-it`
provides coverage for the most common and universal use cases: provides coverage for the most common and universal use cases:
```js ```js
var Remarkable = require('remarkable'); var md = require('markdown-it')({
var md = new Remarkable({
typographer: true, typographer: true,
quotes: '“”‘’' quotes: '“”‘’'
}); });
@ -255,7 +255,7 @@ more advanced or specific to your language.
Easily load plugins with the `.use()` method: Easily load plugins with the `.use()` method:
```js ```js
var md = new Remarkable(); var md = require('markdown-it')();
md.use(plugin1) md.use(plugin1)
.use(plugin2, opts) .use(plugin2, opts)
@ -284,14 +284,14 @@ reconfigure anyone as you wish. Render also can be modified and extended. See
source code to understand details. Pay attention to these properties: source code to understand details. Pay attention to these properties:
```js ```js
Remarkable.core MarkdownIt.core
Remarkable.core.ruler MarkdownIt.core.ruler
Remarkable.block MarkdownIt.block
Remarkable.block.ruler MarkdownIt.block.ruler
Remarkable.inline MarkdownIt.inline
Remarkable.inline.ruler MarkdownIt.inline.ruler
Remarkable.renderer MarkdownIt.renderer
Remarkable.renderer.rules MarkdownIt.renderer.rules
``` ```
## Benchmark ## Benchmark
@ -310,17 +310,16 @@ Sample: spec.txt (110610 bytes)
> marked-0.3.2 x 22.92 ops/sec ±0.79% (41 runs sampled) > marked-0.3.2 x 22.92 ops/sec ±0.79% (41 runs sampled)
``` ```
As you can see, `remarkabe` doesn't pay with speed for it's flexibility. Because As you can see, `markdown-it` doesn't pay with speed for it's flexibility.
it's written in monomorphyc style and use JIT inline caches effectively. Because it's written in monomorphyc style and use JIT inline caches effectively.
## Authors ## Authors
- Jon Schlinkert [github/jonschlinkert](https://github.com/jonschlinkert)
- Alex Kocharin [github/rlidwka](https://github.com/rlidwka) - Alex Kocharin [github/rlidwka](https://github.com/rlidwka)
- Vitaly Puzrin [github/puzrin](https://github.com/puzrin) - Vitaly Puzrin [github/puzrin](https://github.com/puzrin)
## License ## License
[MIT](https://github.com/jonschlinkert/remarkable/blob/master/LICENSE) [MIT](https://github.com/markdown-it/markdown-it/blob/master/LICENSE)

3
benchmark/implementations/current-commonmark/index.js

@ -1,7 +1,6 @@
'use strict' 'use strict'
var Remarkable = require('../../../'); var md = require('../../../')('commonmark');
var md = new Remarkable('commonmark');
exports.run = function(data) { exports.run = function(data) {
return md.render(data); return md.render(data);

3
benchmark/implementations/current/index.js

@ -1,7 +1,6 @@
'use strict' 'use strict'
var Remarkable = require('../../../'); var md = require('../../../')({
var md = new Remarkable({
html: true, html: true,
linkify: true, linkify: true,
typographer: true typographer: true

2
benchmark/implementations/marked-0.3.2/index.js

@ -1,6 +1,6 @@
'use strict' 'use strict'
var marked = new require('marked'); var marked = require('marked');
exports.run = function(data) { exports.run = function(data) {
return marked(data); return marked(data);

3
benchmark/profile.js

@ -4,9 +4,8 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var Remarkable = require('../');
var md = new Remarkable({ var md = require('../')({
html: true, html: true,
linkify: false, linkify: false,
typographer: false typographer: false

4
benchmark/samples/lorem1.txt

@ -1,6 +1,6 @@
Lorem ipsum dolor sit amet, __consectetur__ adipiscing elit. Cras imperdiet nec erat ac condimentum. Nulla vel rutrum ligula. Sed hendrerit interdum orci a posuere. Vivamus ut velit aliquet, mollis purus eget, iaculis nisl. Proin posuere malesuada ante. Proin auctor orci eros, ac molestie lorem dictum nec. Vestibulum sit amet erat est. Morbi luctus sed elit ac luctus. Proin blandit, enim vitae egestas posuere, neque elit ultricies dui, vel mattis nibh enim ac lorem. Maecenas molestie nisl sit amet velit dictum lobortis. Aliquam erat volutpat. Lorem ipsum dolor sit amet, __consectetur__ adipiscing elit. Cras imperdiet nec erat ac condimentum. Nulla vel rutrum ligula. Sed hendrerit interdum orci a posuere. Vivamus ut velit aliquet, mollis purus eget, iaculis nisl. Proin posuere malesuada ante. Proin auctor orci eros, ac molestie lorem dictum nec. Vestibulum sit amet erat est. Morbi luctus sed elit ac luctus. Proin blandit, enim vitae egestas posuere, neque elit ultricies dui, vel mattis nibh enim ac lorem. Maecenas molestie nisl sit amet velit dictum lobortis. Aliquam erat volutpat.
Vivamus sagittis, diam in [vehicula](https://github.com/jonschlinkert/remarked) lobortis, sapien arcu mattis erat, vel aliquet sem urna et risus. Ut feugiat sapien vitae mi elementum laoreet. Suspendisse potenti. Aliquam erat nisl, aliquam pretium libero aliquet, sagittis eleifend nunc. In hac habitasse platea dictumst. Integer turpis augue, tincidunt dignissim mauris id, rhoncus dapibus purus. Maecenas et enim odio. Nullam massa metus, varius quis vehicula sed, pharetra mollis erat. In quis viverra velit. Vivamus placerat, est nec hendrerit varius, enim dui hendrerit magna, ut pulvinar nibh lorem vel lacus. Mauris a orci iaculis, hendrerit eros sed, gravida leo. In dictum mauris vel augue varius, ac ullamcorper nisl ornare. In eu posuere velit, ac fermentum arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam sed malesuada leo, at interdum elit. Vivamus sagittis, diam in [vehicula](https://github.com/markdown-it/markdown-it) lobortis, sapien arcu mattis erat, vel aliquet sem urna et risus. Ut feugiat sapien vitae mi elementum laoreet. Suspendisse potenti. Aliquam erat nisl, aliquam pretium libero aliquet, sagittis eleifend nunc. In hac habitasse platea dictumst. Integer turpis augue, tincidunt dignissim mauris id, rhoncus dapibus purus. Maecenas et enim odio. Nullam massa metus, varius quis vehicula sed, pharetra mollis erat. In quis viverra velit. Vivamus placerat, est nec hendrerit varius, enim dui hendrerit magna, ut pulvinar nibh lorem vel lacus. Mauris a orci iaculis, hendrerit eros sed, gravida leo. In dictum mauris vel augue varius, ac ullamcorper nisl ornare. In eu posuere velit, ac fermentum arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam sed malesuada leo, at interdum elit.
Nullam ut tincidunt nunc. [Pellentesque][1] metus lacus, commodo eget justo ut, rutrum varius nunc. Sed non rhoncus risus. Morbi sodales gravida pulvinar. Duis malesuada, odio volutpat elementum vulputate, massa magna scelerisque ante, et accumsan tellus nunc in sem. Donec mattis arcu et velit aliquet, non sagittis justo vestibulum. Suspendisse volutpat felis lectus, nec consequat ipsum mattis id. Donec dapibus vehicula facilisis. In tincidunt mi nisi, nec faucibus tortor euismod nec. Suspendisse ante ligula, aliquet vitae libero eu, vulputate dapibus libero. Sed bibendum, sapien at posuere interdum, libero est sollicitudin magna, ac gravida tellus purus eu ipsum. Proin ut quam arcu. Nullam ut tincidunt nunc. [Pellentesque][1] metus lacus, commodo eget justo ut, rutrum varius nunc. Sed non rhoncus risus. Morbi sodales gravida pulvinar. Duis malesuada, odio volutpat elementum vulputate, massa magna scelerisque ante, et accumsan tellus nunc in sem. Donec mattis arcu et velit aliquet, non sagittis justo vestibulum. Suspendisse volutpat felis lectus, nec consequat ipsum mattis id. Donec dapibus vehicula facilisis. In tincidunt mi nisi, nec faucibus tortor euismod nec. Suspendisse ante ligula, aliquet vitae libero eu, vulputate dapibus libero. Sed bibendum, sapien at posuere interdum, libero est sollicitudin magna, ac gravida tellus purus eu ipsum. Proin ut quam arcu.
@ -10,4 +10,4 @@ Proin diam quam, elementum in eleifend id, elementum et metus. Cras in justo con
Nunc et leo erat. Aenean mattis ultrices lorem, eget adipiscing dolor ultricies eu. In hac habitasse platea dictumst. Vivamus cursus feugiat sapien quis aliquam. Mauris quam libero, porta vel volutpat ut, blandit a purus. Vivamus vestibulum dui vel tortor molestie, sit amet feugiat sem commodo. Nulla facilisi. Sed molestie arcu eget tellus vestibulum tristique. Nunc et leo erat. Aenean mattis ultrices lorem, eget adipiscing dolor ultricies eu. In hac habitasse platea dictumst. Vivamus cursus feugiat sapien quis aliquam. Mauris quam libero, porta vel volutpat ut, blandit a purus. Vivamus vestibulum dui vel tortor molestie, sit amet feugiat sem commodo. Nulla facilisi. Sed molestie arcu eget tellus vestibulum tristique.
[1]: https://github.com/jonschlinkert [1]: https://github.com/markdown-it

5
bin/remarkable.js → bin/markdown-it.js

@ -7,12 +7,11 @@
var fs = require('fs'); var fs = require('fs');
var argparse = require('argparse'); var argparse = require('argparse');
var Remarkable = require('..');
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var cli = new argparse.ArgumentParser({ var cli = new argparse.ArgumentParser({
prog: 'remarkable', prog: 'markdown-it.js',
version: require('../package.json').version, version: require('../package.json').version,
addHelp: true addHelp: true
}); });
@ -61,7 +60,7 @@ readFile(options.file, 'utf8', function (err, input) {
process.exit(1); process.exit(1);
} }
md = new Remarkable('full', { md = require('..')('full', {
html: true, html: true,
xhtmlOut: true, xhtmlOut: true,
typographer: true, typographer: true,

6
bower.json

@ -1,7 +1,7 @@
{ {
"name": "remarkable", "name": "markdown-it",
"main": "dist/remarkable.js", "main": "dist/markdown-it.js",
"homepage": "https://github.com/jonschlinkert/remarkable", "homepage": "https://github.com/markdown-it/markdown-it",
"description": "Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one.", "description": "Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one.",
"keywords": [ "keywords": [
"markdown", "markdown",

8
demo/assets/index.js

@ -52,11 +52,11 @@
function mdInit() { function mdInit() {
if (defaults._strict) { if (defaults._strict) {
mdHtml = new window.Remarkable('commonmark'); mdHtml = window.markdownit('commonmark');
mdSrc = new window.Remarkable('commonmark'); mdSrc = window.markdownit('commonmark');
} else { } else {
mdHtml = new window.Remarkable('full', defaults); mdHtml = window.markdownit('full', defaults);
mdSrc = new window.Remarkable('full', defaults); mdSrc = window.markdownit('full', defaults);
} }
// Beautify output of parser for html content // Beautify output of parser for html content

22
demo/index.html

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Remarkable demo</title> <title>markdown-it demo</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -12,7 +12,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.2.0/css/bootstrap.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.2.0/css/bootstrap.css">
<script src="https://cdn.jsdelivr.net/highlight.js/8.4.0/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/highlight.js/8.4.0/highlight.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css">
<script src="../dist/remarkable.js"></script> <script src="../dist/markdown-it.js"></script>
<link rel="stylesheet" href="./assets/index.css"> <link rel="stylesheet" href="./assets/index.css">
<script src="./assets/index.js"></script> <script src="./assets/index.js"></script>
<!-- Ancient IE support - load shiv & kill broken highlighter--><!--[if lt IE 9]> <!-- Ancient IE support - load shiv & kill broken highlighter--><!--[if lt IE 9]>
@ -35,12 +35,14 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>Remarkable demo</h1> <h1>
markdown-it
<small>demo</small>
</h1>
<p><a data-toggle="collapse" href="#code-sample">code sample</a></p> <p><a data-toggle="collapse" href="#code-sample">code sample</a></p>
<pre id="code-sample" class="collapse code-sample"><code class="js">var Remarkable = require('remarkable'); <pre id="code-sample" class="collapse code-sample"><code class="js">var hljs = require('highlight.js') // https://highlightjs.org/
var hljs = require('highlight.js') // https://highlightjs.org/
var md = new Remarkable('full', { var md = require('markdown-it')('full', {
html: false, // Enable HTML tags in source html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (&lt;br /&gt;) xhtmlOut: false, // Use '/' to close single tags (&lt;br /&gt;)
breaks: false, // Convert '\n' in paragraphs into &lt;br&gt; breaks: false, // Convert '\n' in paragraphs into &lt;br&gt;
@ -71,8 +73,8 @@ var md = new Remarkable('full', {
} }
}); });
console.log(md.render('# Remarkable rulezz!')); console.log(md.render('# markdown-it rulezz!'));
// =&gt; &lt;h1&gt;Remarkable rulezz!&lt;/h1&gt; // =&gt; &lt;h1&gt;markdown-it rulezz!&lt;/h1&gt;
</code></pre> </code></pre>
<div class="form-inline demo-options"> <div class="form-inline demo-options">
<div class="checkbox not-strict"> <div class="checkbox not-strict">
@ -158,7 +160,7 @@ test.. test... test..... test?..... test!....
!!!!!! ???? ,, !!!!!! ???? ,,
Remarkable -- awesome markdown-it -- awesome
&quot;Smartypants, double quotes&quot; &quot;Smartypants, double quotes&quot;
@ -349,6 +351,6 @@ It converts &quot;HTML&quot;, but keep intact partial entries like &quot;xxxHTML
</section> </section>
</div> </div>
</div> </div>
<div class="gh-ribbon"><a href="https://github.com/jonschlinkert/remarkable" target="_blank">Fork me on GitHub</a></div> <div class="gh-ribbon"><a href="https://github.com/markdown-it/markdown-it" target="_blank">Fork me on GitHub</a></div>
</body> </body>
</html> </html>

10
demo/index.jade

@ -1,7 +1,7 @@
doctype html doctype html
html html
head head
title Remarkable demo title markdown-it demo
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge') meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1') meta(name='viewport' content='width=device-width, initial-scale=1')
@ -17,7 +17,7 @@ html
script(src='https://cdn.jsdelivr.net/highlight.js/8.4.0/highlight.min.js') script(src='https://cdn.jsdelivr.net/highlight.js/8.4.0/highlight.min.js')
link(rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css') link(rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css')
script(src='../dist/remarkable.js') script(src='../dist/markdown-it.js')
link(rel='stylesheet' href='./assets/index.css') link(rel='stylesheet' href='./assets/index.css')
script(src='./assets/index.js') script(src='./assets/index.js')
@ -43,7 +43,9 @@ html
body body
.container .container
- var s = self.self.demo; - var s = self.self.demo;
h1 Remarkable demo h1 markdown-it
|
small demo
p: a(data-toggle='collapse' href='#code-sample') code sample p: a(data-toggle='collapse' href='#code-sample') code sample
pre.collapse.code-sample(id='code-sample') pre.collapse.code-sample(id='code-sample')
@ -104,4 +106,4 @@ html
code.result-debug-content.full-height code.result-debug-content.full-height
.gh-ribbon .gh-ribbon
a(href='https://github.com/jonschlinkert/remarkable' target='_blank') Fork me on GitHub a(href='https://github.com/markdown-it/markdown-it' target='_blank') Fork me on GitHub

7
demo/sample.js

@ -1,7 +1,6 @@
var Remarkable = require('remarkable');
var hljs = require('highlight.js') // https://highlightjs.org/ var hljs = require('highlight.js') // https://highlightjs.org/
var md = new Remarkable('full', { var md = require('markdown-it')('full', {
html: false, // Enable HTML tags in source html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (<br />) xhtmlOut: false, // Use '/' to close single tags (<br />)
breaks: false, // Convert '\n' in paragraphs into <br> breaks: false, // Convert '\n' in paragraphs into <br>
@ -32,5 +31,5 @@ var md = new Remarkable('full', {
} }
}); });
console.log(md.render('# Remarkable rulezz!')); console.log(md.render('# markdown-it rulezz!'));
// => <h1>Remarkable rulezz!</h1> // => <h1>markdown-it rulezz!</h1>

2
demo/sample.md

@ -37,7 +37,7 @@ test.. test... test..... test?..... test!....
!!!!!! ???? ,, !!!!!! ???? ,,
Remarkable -- awesome markdown-it -- awesome
"Smartypants, double quotes" "Smartypants, double quotes"

32
dist/remarkable.js → dist/markdown-it.js

@ -1,4 +1,4 @@
/*! remarkable 1.5.0 https://github.com//jonschlinkert/remarkable @license MIT */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Remarkable=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ /*! markdown-it 2.0.0 https://github.com//markdown-it/markdown-it @license MIT */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.markdownit=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// List of valid entities // List of valid entities
// //
// Generate with ./support/entities.js script // Generate with ./support/entities.js script
@ -2642,7 +2642,7 @@ module.exports = {
}; };
},{}],7:[function(require,module,exports){ },{}],7:[function(require,module,exports){
// Remarkable default options // markdown-it default options
'use strict'; 'use strict';
@ -2722,7 +2722,7 @@ module.exports = {
}; };
},{}],8:[function(require,module,exports){ },{}],8:[function(require,module,exports){
// Remarkable default options // markdown-it `full` options
'use strict'; 'use strict';
@ -3005,7 +3005,11 @@ function StateCore(self, src, env) {
// Main class // Main class
// //
function Remarkable(presetName, options) { function MarkdownIt(presetName, options) {
if (!(this instanceof MarkdownIt)) {
return new MarkdownIt(presetName, options);
}
if (!options) { if (!options) {
if (!isString(presetName)) { if (!isString(presetName)) {
options = presetName || {}; options = presetName || {};
@ -3028,17 +3032,17 @@ function Remarkable(presetName, options) {
// Set options, if you did not passed those to constructor // Set options, if you did not passed those to constructor
// //
Remarkable.prototype.set = function (options) { MarkdownIt.prototype.set = function (options) {
assign(this.options, options); assign(this.options, options);
}; };
// Batch loader for components rules states & options // Batch loader for components rules states & options
// //
Remarkable.prototype.configure = function (presets) { MarkdownIt.prototype.configure = function (presets) {
var self = this; var self = this;
if (!presets) { throw new Error('Wrong `remarkable` preset, check name/content'); } if (!presets) { throw new Error('Wrong `markdown-it` preset, check name/content'); }
if (presets.options) { self.set(presets.options); } if (presets.options) { self.set(presets.options); }
@ -3054,13 +3058,13 @@ Remarkable.prototype.configure = function (presets) {
// Sugar for curried plugins init: // Sugar for curried plugins init:
// //
// var md = new Remarkable(); // var md = new MarkdownIt();
// //
// md.use(plugin1) // md.use(plugin1)
// .use(plugin2, opts) // .use(plugin2, opts)
// .use(plugin3); // .use(plugin3);
// //
Remarkable.prototype.use = function (plugin, opts) { MarkdownIt.prototype.use = function (plugin, opts) {
plugin(this, opts); plugin(this, opts);
return this; return this;
}; };
@ -3069,7 +3073,7 @@ Remarkable.prototype.use = function (plugin, opts) {
// Parse input string, returns tokens array. Modify `env` with // Parse input string, returns tokens array. Modify `env` with
// definitions data. // definitions data.
// //
Remarkable.prototype.parse = function (src, env) { MarkdownIt.prototype.parse = function (src, env) {
var state = new StateCore(this, src, env); var state = new StateCore(this, src, env);
this.core.process(state); this.core.process(state);
@ -3079,7 +3083,7 @@ Remarkable.prototype.parse = function (src, env) {
// Main method that does all magic :) // Main method that does all magic :)
// //
Remarkable.prototype.render = function (src, env) { MarkdownIt.prototype.render = function (src, env) {
env = env || {}; env = env || {};
return this.renderer.render(this.parse(src, env), this.options, env); return this.renderer.render(this.parse(src, env), this.options, env);
@ -3088,7 +3092,7 @@ Remarkable.prototype.render = function (src, env) {
// Parse content as single string // Parse content as single string
// //
Remarkable.prototype.parseInline = function (src, env) { MarkdownIt.prototype.parseInline = function (src, env) {
var state = new StateCore(this, src, env); var state = new StateCore(this, src, env);
state.inlineMode = true; state.inlineMode = true;
@ -3099,14 +3103,14 @@ Remarkable.prototype.parseInline = function (src, env) {
// Render single string, without wrapping it to paragraphs // Render single string, without wrapping it to paragraphs
// //
Remarkable.prototype.renderInline = function (src, env) { MarkdownIt.prototype.renderInline = function (src, env) {
env = env || {}; env = env || {};
return this.renderer.render(this.parseInline(src, env), this.options, env); return this.renderer.render(this.parseInline(src, env), this.options, env);
}; };
module.exports = Remarkable; module.exports = MarkdownIt;
// Expose helpers, useful for custom renderer functions // Expose helpers, useful for custom renderer functions
module.exports.utils = require('./common/utils'); module.exports.utils = require('./common/utils');

4
dist/markdown-it.min.js

File diff suppressed because one or more lines are too long

4
dist/remarkable.min.js

File diff suppressed because one or more lines are too long

2
lib/configs/default.js

@ -1,4 +1,4 @@
// Remarkable default options // markdown-it default options
'use strict'; 'use strict';

2
lib/configs/full.js

@ -1,4 +1,4 @@
// Remarkable default options // markdown-it `full` options
'use strict'; 'use strict';

26
lib/index.js

@ -33,7 +33,11 @@ function StateCore(self, src, env) {
// Main class // Main class
// //
function Remarkable(presetName, options) { function MarkdownIt(presetName, options) {
if (!(this instanceof MarkdownIt)) {
return new MarkdownIt(presetName, options);
}
if (!options) { if (!options) {
if (!isString(presetName)) { if (!isString(presetName)) {
options = presetName || {}; options = presetName || {};
@ -56,17 +60,17 @@ function Remarkable(presetName, options) {
// Set options, if you did not passed those to constructor // Set options, if you did not passed those to constructor
// //
Remarkable.prototype.set = function (options) { MarkdownIt.prototype.set = function (options) {
assign(this.options, options); assign(this.options, options);
}; };
// Batch loader for components rules states & options // Batch loader for components rules states & options
// //
Remarkable.prototype.configure = function (presets) { MarkdownIt.prototype.configure = function (presets) {
var self = this; var self = this;
if (!presets) { throw new Error('Wrong `remarkable` preset, check name/content'); } if (!presets) { throw new Error('Wrong `markdown-it` preset, check name/content'); }
if (presets.options) { self.set(presets.options); } if (presets.options) { self.set(presets.options); }
@ -82,13 +86,13 @@ Remarkable.prototype.configure = function (presets) {
// Sugar for curried plugins init: // Sugar for curried plugins init:
// //
// var md = new Remarkable(); // var md = new MarkdownIt();
// //
// md.use(plugin1) // md.use(plugin1)
// .use(plugin2, opts) // .use(plugin2, opts)
// .use(plugin3); // .use(plugin3);
// //
Remarkable.prototype.use = function (plugin, opts) { MarkdownIt.prototype.use = function (plugin, opts) {
plugin(this, opts); plugin(this, opts);
return this; return this;
}; };
@ -97,7 +101,7 @@ Remarkable.prototype.use = function (plugin, opts) {
// Parse input string, returns tokens array. Modify `env` with // Parse input string, returns tokens array. Modify `env` with
// definitions data. // definitions data.
// //
Remarkable.prototype.parse = function (src, env) { MarkdownIt.prototype.parse = function (src, env) {
var state = new StateCore(this, src, env); var state = new StateCore(this, src, env);
this.core.process(state); this.core.process(state);
@ -107,7 +111,7 @@ Remarkable.prototype.parse = function (src, env) {
// Main method that does all magic :) // Main method that does all magic :)
// //
Remarkable.prototype.render = function (src, env) { MarkdownIt.prototype.render = function (src, env) {
env = env || {}; env = env || {};
return this.renderer.render(this.parse(src, env), this.options, env); return this.renderer.render(this.parse(src, env), this.options, env);
@ -116,7 +120,7 @@ Remarkable.prototype.render = function (src, env) {
// Parse content as single string // Parse content as single string
// //
Remarkable.prototype.parseInline = function (src, env) { MarkdownIt.prototype.parseInline = function (src, env) {
var state = new StateCore(this, src, env); var state = new StateCore(this, src, env);
state.inlineMode = true; state.inlineMode = true;
@ -127,14 +131,14 @@ Remarkable.prototype.parseInline = function (src, env) {
// Render single string, without wrapping it to paragraphs // Render single string, without wrapping it to paragraphs
// //
Remarkable.prototype.renderInline = function (src, env) { MarkdownIt.prototype.renderInline = function (src, env) {
env = env || {}; env = env || {};
return this.renderer.render(this.parseInline(src, env), this.options, env); return this.renderer.render(this.parseInline(src, env), this.options, env);
}; };
module.exports = Remarkable; module.exports = MarkdownIt;
// Expose helpers, useful for custom renderer functions // Expose helpers, useful for custom renderer functions
module.exports.utils = require('./common/utils'); module.exports.utils = require('./common/utils');

16
package.json

@ -1,19 +1,19 @@
{ {
"name": "remarkable", "name": "markdown-it",
"version": "1.5.0", "version": "2.0.0",
"description": "Markdown parser, done right.", "description": "Markdown parser with plugins",
"keywords": [ "keywords": [
"markdown", "markdown",
"parser", "parser",
"commonmark" "commonmark"
], ],
"homepage": "https://github.com/jonschlinkert/remarkable", "homepage": "https://github.com/markdown-it/markdown-it",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/jonschlinkert/remarkable.git" "url": "git://github.com/markdown-it/markdown-it.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/jonschlinkert/remarkable/issues" "url": "https://github.com/markdown-it/markdown-it/issues"
}, },
"license": "MIT", "license": "MIT",
"main": "index.js", "main": "index.js",
@ -26,12 +26,12 @@
}, },
"devDependencies": { "devDependencies": {
"ansi": "^0.3.0", "ansi": "^0.3.0",
"autoprefixer-stylus": "^0.3.0", "autoprefixer-stylus": "^0.4.0",
"benchmark": "^1.0.0", "benchmark": "^1.0.0",
"browserify": "*", "browserify": "*",
"commonmark": "0.12.0", "commonmark": "0.12.0",
"coveralls": "^2.11.2", "coveralls": "^2.11.2",
"eslint": "0.10.1", "eslint": "0.10.2",
"eslint-plugin-nodeca": "^1.0.0", "eslint-plugin-nodeca": "^1.0.0",
"istanbul": "*", "istanbul": "*",
"jade": "^1.6.0", "jade": "^1.6.0",

4
support/specsplit.js

@ -11,8 +11,6 @@ var fs = require('fs');
var util = require('util'); var util = require('util');
var argparse = require('argparse'); var argparse = require('argparse');
var Remarkable = require('..');
var cli = new argparse.ArgumentParser({ var cli = new argparse.ArgumentParser({
prog: 'specsplit', prog: 'specsplit',
@ -57,7 +55,7 @@ function readFile(filename, encoding, callback) {
readFile(options.spec, 'utf8', function (error, input) { readFile(options.spec, 'utf8', function (error, input) {
var good = [], bad = [], var good = [], bad = [],
markdown = new Remarkable('commonmark'); markdown = require('..')('commonmark');
if (error) { if (error) {
if (error.code === 'ENOENT') { if (error.code === 'ENOENT') {

3
test/commonmark.js

@ -6,11 +6,10 @@ var path = require('path');
var utils = require('./utils'); var utils = require('./utils');
var Remarked = require('../');
describe('CommonMark', function () { describe('CommonMark', function () {
var md = new Remarked('commonmark'); var md = require('../')('commonmark');
utils.addTests(path.join(__dirname, 'fixtures/commonmark/good.txt'), md); utils.addTests(path.join(__dirname, 'fixtures/commonmark/good.txt'), md);
}); });

0
test/fixtures/remarkable/abbr.txt → test/fixtures/markdown-it/abbr.txt

0
test/fixtures/remarkable/commonmark_extras.txt → test/fixtures/markdown-it/commonmark_extras.txt

0
test/fixtures/remarkable/deflist.txt → test/fixtures/markdown-it/deflist.txt

0
test/fixtures/remarkable/del.txt → test/fixtures/markdown-it/del.txt

0
test/fixtures/remarkable/footnotes.txt → test/fixtures/markdown-it/footnotes.txt

0
test/fixtures/remarkable/ins.txt → test/fixtures/markdown-it/ins.txt

0
test/fixtures/remarkable/linkify.txt → test/fixtures/markdown-it/linkify.txt

0
test/fixtures/remarkable/mark.txt → test/fixtures/markdown-it/mark.txt

0
test/fixtures/remarkable/proto.txt → test/fixtures/markdown-it/proto.txt

0
test/fixtures/remarkable/smartquotes.txt → test/fixtures/markdown-it/smartquotes.txt

0
test/fixtures/remarkable/sub.txt → test/fixtures/markdown-it/sub.txt

0
test/fixtures/remarkable/sup.txt → test/fixtures/markdown-it/sup.txt

0
test/fixtures/remarkable/tables.txt → test/fixtures/markdown-it/tables.txt

16
test/fixtures/remarkable/typographer.txt → test/fixtures/markdown-it/typographer.txt

@ -63,22 +63,22 @@ dupes
dashes dashes
. .
---remarkable --- super--- ---markdownit --- super---
remarkable---awesome markdownit---awesome
abc ---- abc ----
. .
<p>—remarkable — super—</p> <p>—markdownit — super—</p>
<p>remarkable—awesome</p> <p>markdownit—awesome</p>
<p>abc ----</p> <p>abc ----</p>
. .
. .
--remarkable -- super-- --markdownit -- super--
remarkable--awesome markdownit--awesome
. .
<p>–remarkable – super–</p> <p>–markdownit – super–</p>
<p>remarkable–awesome</p> <p>markdownit–awesome</p>
. .

0
test/fixtures/remarkable/xss.txt → test/fixtures/markdown-it/xss.txt

7
test/remarkable.js → test/markdown-it.js

@ -6,16 +6,15 @@ var path = require('path');
var utils = require('./utils'); var utils = require('./utils');
var Remarkable = require('../');
describe('remarkable', function () { describe('markdownit', function () {
var md = new Remarkable('full', { var md = require('../')('full', {
html: true, html: true,
langPrefix: '', langPrefix: '',
typographer: true, typographer: true,
linkify: true linkify: true
}); });
utils.addTests(path.join(__dirname, 'fixtures/remarkable'), md); utils.addTests(path.join(__dirname, 'fixtures/markdown-it'), md);
}); });

30
test/misc.js

@ -3,7 +3,7 @@
var assert = require('assert'); var assert = require('assert');
var Remarkable = require('../'); var markdownit = require('../');
var utils = require('../').utils; var utils = require('../').utils;
@ -58,13 +58,13 @@ describe('API', function () {
it('constructor', function () { it('constructor', function () {
assert.throws(function () { assert.throws(function () {
var md = new Remarkable('bad preset'); var md = markdownit('bad preset');
md.render('123'); md.render('123');
}); });
}); });
it('configure coverage', function () { it('configure coverage', function () {
var md = new Remarkable('full'); var md = markdownit('full');
// conditions coverage // conditions coverage
md.configure({}); md.configure({});
@ -77,7 +77,7 @@ describe('API', function () {
function plugin(self, opts) { if (opts === 'bar') { succeeded = true; } } function plugin(self, opts) { if (opts === 'bar') { succeeded = true; } }
var md = new Remarkable(); var md = markdownit();
md.use(plugin, 'foo'); md.use(plugin, 'foo');
assert.strictEqual(succeeded, false); assert.strictEqual(succeeded, false);
@ -86,7 +86,7 @@ describe('API', function () {
}); });
it('highlight', function () { it('highlight', function () {
var md = new Remarkable({ var md = markdownit({
highlight: function (str) { highlight: function (str) {
return '==' + str + '=='; return '==' + str + '==';
} }
@ -96,7 +96,7 @@ describe('API', function () {
}); });
it('highlight escape by default', function () { it('highlight escape by default', function () {
var md = new Remarkable({ var md = markdownit({
highlight: function () { highlight: function () {
return ''; return '';
} }
@ -106,7 +106,7 @@ describe('API', function () {
}); });
it('force hardbreaks', function () { it('force hardbreaks', function () {
var md = new Remarkable({ breaks: true }); var md = markdownit({ breaks: true });
assert.strictEqual(md.render('a\nb'), '<p>a<br>\nb</p>\n'); assert.strictEqual(md.render('a\nb'), '<p>a<br>\nb</p>\n');
md.set({ xhtmlOut: true }); md.set({ xhtmlOut: true });
@ -114,7 +114,7 @@ describe('API', function () {
}); });
it('xhtmlOut enabled', function () { it('xhtmlOut enabled', function () {
var md = new Remarkable({ xhtmlOut: true }); var md = markdownit({ xhtmlOut: true });
assert.strictEqual(md.render('---'), '<hr />\n'); assert.strictEqual(md.render('---'), '<hr />\n');
assert.strictEqual(md.render('![]()'), '<p><img src="" alt="" /></p>\n'); assert.strictEqual(md.render('![]()'), '<p><img src="" alt="" /></p>\n');
@ -122,7 +122,7 @@ describe('API', function () {
}); });
it('xhtmlOut disabled', function () { it('xhtmlOut disabled', function () {
var md = new Remarkable(); var md = markdownit();
assert.strictEqual(md.render('---'), '<hr>\n'); assert.strictEqual(md.render('---'), '<hr>\n');
assert.strictEqual(md.render('![]()'), '<p><img src="" alt=""></p>\n'); assert.strictEqual(md.render('![]()'), '<p><img src="" alt=""></p>\n');
@ -135,26 +135,26 @@ describe('API', function () {
describe('Misc', function () { describe('Misc', function () {
it('Should correctly parse strings without tailing \\n', function () { it('Should correctly parse strings without tailing \\n', function () {
var md = new Remarkable(); var md = markdownit();
assert.strictEqual(md.render('123'), '<p>123</p>\n'); assert.strictEqual(md.render('123'), '<p>123</p>\n');
assert.strictEqual(md.render('123\n'), '<p>123</p>\n'); assert.strictEqual(md.render('123\n'), '<p>123</p>\n');
}); });
it('Should quickly exit on empty string', function () { it('Should quickly exit on empty string', function () {
var md = new Remarkable(); var md = markdownit();
assert.strictEqual(md.render(''), ''); assert.strictEqual(md.render(''), '');
}); });
it('Should parse inlines only', function () { it('Should parse inlines only', function () {
var md = new Remarkable('full'); var md = markdownit('full');
assert.strictEqual(md.renderInline('a *b* c'), 'a <em>b</em> c'); assert.strictEqual(md.renderInline('a *b* c'), 'a <em>b</em> c');
}); });
it('Renderer should have pluggable inline and block rules', function () { it('Renderer should have pluggable inline and block rules', function () {
var md = new Remarkable(); var md = markdownit();
md.renderer.rules.em_open = function () { return '<it>'; }; md.renderer.rules.em_open = function () { return '<it>'; };
md.renderer.rules.em_close = function () { return '</it>'; }; md.renderer.rules.em_close = function () { return '</it>'; };
@ -170,7 +170,7 @@ describe('Misc', function () {
describe('Links validation', function () { describe('Links validation', function () {
it('Override validator, disable everything', function () { it('Override validator, disable everything', function () {
var md = new Remarkable({ linkify: true }); var md = markdownit({ linkify: true });
md.inline.validateLink = function () { return false; }; md.inline.validateLink = function () { return false; };
@ -187,7 +187,7 @@ describe('Links validation', function () {
describe('Custom fences', function () { describe('Custom fences', function () {
it('should render differently overriden rule', function () { it('should render differently overriden rule', function () {
var md = new Remarkable(); var md = markdownit();
md.renderer.rules.fence_custom.foo = function (tokens, idx, options, env, self) { md.renderer.rules.fence_custom.foo = function (tokens, idx, options, env, self) {
return '<div class="foo">' + return '<div class="foo">' +

Loading…
Cancel
Save