-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import test from 'tape' | ||
import unified from 'unified' | ||
import gfmSyntax from 'micromark-extension-gfm' | ||
import gfm from 'mdast-util-gfm/from-markdown.js' | ||
import remove from 'unist-util-remove-position' | ||
import {unified} from 'unified' | ||
import {gfm} from 'micromark-extension-gfm' | ||
import {gfmFromMarkdown} from 'mdast-util-gfm' | ||
import {removePosition} from 'unist-util-remove-position' | ||
import remarkParse from './index.js' | ||
|
||
test('remarkParse', function (t) { | ||
|
@@ -14,12 +14,12 @@ test('remarkParse', function (t) { | |
|
||
t.test('extensions', function (st) { | ||
var tree = unified() | ||
.data('micromarkExtensions', [gfmSyntax()]) | ||
.data('fromMarkdownExtensions', [gfm]) | ||
.data('micromarkExtensions', [gfm()]) | ||
.data('fromMarkdownExtensions', [gfmFromMarkdown]) | ||
.use(remarkParse) | ||
.parse('* [x] [email protected] ~~strikethrough~~') | ||
|
||
remove(tree, true) | ||
removePosition(tree, true) | ||
|
||
st.deepEqual( | ||
tree, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import test from 'tape' | ||
import unified from 'unified' | ||
import parse from '../remark-parse/index.js' | ||
import gfm from 'mdast-util-gfm/to-markdown.js' | ||
import {unified} from 'unified' | ||
import {gfmToMarkdown} from 'mdast-util-gfm' | ||
import remarkParse from '../remark-parse/index.js' | ||
import remarkStringify from './index.js' | ||
|
||
test('remarkStringify', function (t) { | ||
|
@@ -314,7 +314,7 @@ test('remarkStringify', function (t) { | |
tests.forEach(function (test) { | ||
st.equal( | ||
unified() | ||
.use(parse) | ||
.use(remarkParse) | ||
.use(remarkStringify) | ||
.processSync(test[1] + '\n\n[bravo]: #\n') | ||
.toString(), | ||
|
@@ -361,21 +361,33 @@ test('remarkStringify', function (t) { | |
|
||
var example = '[[email protected]](mailto:[email protected])' | ||
st.equal( | ||
unified().use(parse).use(remarkStringify).processSync(example).toString(), | ||
unified() | ||
.use(remarkParse) | ||
.use(remarkStringify) | ||
.processSync(example) | ||
.toString(), | ||
'<[email protected]>\n', | ||
'url is `mailto:` plus link text' | ||
) | ||
|
||
example = '[mailto:[email protected]](mailto:[email protected])' | ||
st.equal( | ||
unified().use(parse).use(remarkStringify).processSync(example).toString(), | ||
unified() | ||
.use(remarkParse) | ||
.use(remarkStringify) | ||
.processSync(example) | ||
.toString(), | ||
'<mailto:[email protected]>\n', | ||
'url is link text' | ||
) | ||
|
||
example = '[example](mailto:[email protected])\n' | ||
st.equal( | ||
unified().use(parse).use(remarkStringify).processSync(example).toString(), | ||
unified() | ||
.use(remarkParse) | ||
.use(remarkStringify) | ||
.processSync(example) | ||
.toString(), | ||
example, | ||
'url is not link text' | ||
) | ||
|
@@ -456,7 +468,7 @@ test('stringify escapes', function (t) { | |
|
||
test('extensions', function (t) { | ||
var doc = unified() | ||
.data('toMarkdownExtensions', [gfm()]) | ||
.data('toMarkdownExtensions', [gfmToMarkdown()]) | ||
.use(remarkStringify) | ||
.stringify({ | ||
type: 'root', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters