-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
34 changed files
with
267 additions
and
277 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
node_modules/ | ||
coverage/ | ||
node_modules/ | ||
packages/remark/*.d.ts | ||
packages/remark-cli/*.d.ts | ||
packages/remark-parse/lib/*.d.ts | ||
packages/remark-parse/test.d.ts | ||
packages/remark-stringify/lib/*.d.ts | ||
packages/remark-stringify/test.d.ts | ||
script/**/*.d.ts | ||
test/**/*.d.ts | ||
.DS_Store | ||
*.log | ||
yarn.lock |
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
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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["*.js"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This wrapper exists because JS in TS can’t export a `@type` of a function. | ||
import type {Options} from './lib/index.js' | ||
import type {Root} from 'mdast' | ||
import type {Plugin} from 'unified' | ||
declare const remarkParse: Plugin<[Options?] | void[], string, Root> | ||
export default remarkParse | ||
export type {Options} |
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,16 +1,3 @@ | ||
import {fromMarkdown} from 'mdast-util-from-markdown' | ||
import remarkParse from './lib/index.js' | ||
|
||
export default function remarkParse(options) { | ||
this.Parser = (doc) => { | ||
return fromMarkdown( | ||
doc, | ||
Object.assign({}, this.data('settings'), options, { | ||
// Note: these options are not in the readme. | ||
// The goal is for them to be set by plugins on `data` instead of being | ||
// passed by users. | ||
extensions: this.data('micromarkExtensions') || [], | ||
mdastExtensions: this.data('fromMarkdownExtensions') || [] | ||
}) | ||
) | ||
} | ||
} | ||
export default remarkParse |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @typedef {import('mdast').Root} Root | ||
* @typedef {import('mdast-util-from-markdown').Options} Options | ||
*/ | ||
|
||
import {fromMarkdown} from 'mdast-util-from-markdown' | ||
|
||
/** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */ | ||
export default function remarkParse(options) { | ||
/** @type {import('unified').ParserFunction<Root>} */ | ||
const parser = (doc) => { | ||
// Assume options. | ||
const settings = /** @type {Options} */ (this.data('settings')) | ||
|
||
return fromMarkdown( | ||
doc, | ||
Object.assign({}, settings, options, { | ||
// Note: these options are not in the readme. | ||
// The goal is for them to be set by plugins on `data` instead of being | ||
// passed by users. | ||
extensions: this.data('micromarkExtensions') || [], | ||
mdastExtensions: this.data('fromMarkdownExtensions') || [] | ||
}) | ||
) | ||
} | ||
|
||
Object.assign(this, {Parser: parser}) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["lib/**/*.js", "test.js"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This wrapper exists because JS in TS can’t export a `@type` of a function. | ||
import type {Options} from './lib/index.js' | ||
import type {Root} from 'mdast' | ||
import type {Plugin} from 'unified' | ||
declare const remarkStringify: Plugin<[Options?] | void[], Root, string> | ||
export default remarkStringify | ||
export type {Options} |
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,15 +1,3 @@ | ||
import {toMarkdown} from 'mdast-util-to-markdown' | ||
import remarkStringify from './lib/index.js' | ||
|
||
export default function remarkStringify(options) { | ||
this.Compiler = (tree) => { | ||
return toMarkdown( | ||
tree, | ||
Object.assign({}, this.data('settings'), options, { | ||
// Note: this option is not in the readme. | ||
// The goal is for it to be set by plugins on `data` instead of being | ||
// passed by users. | ||
extensions: this.data('toMarkdownExtensions') || [] | ||
}) | ||
) | ||
} | ||
} | ||
export default remarkStringify |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @typedef {import('mdast').Root|import('mdast').Content} Node | ||
* @typedef {import('mdast-util-to-markdown').Options} Options | ||
*/ | ||
|
||
import {toMarkdown} from 'mdast-util-to-markdown' | ||
|
||
/** @type {import('unified').Plugin<[Options]|void[], Node, string>} */ | ||
export default function remarkStringify(options) { | ||
/** @type {import('unified').CompilerFunction<Node, string>} */ | ||
const compiler = (tree) => { | ||
// Assume options. | ||
const settings = /** @type {Options} */ (this.data('settings')) | ||
|
||
return toMarkdown( | ||
tree, | ||
Object.assign({}, settings, options, { | ||
// Note: this option is not in the readme. | ||
// The goal is for it to be set by plugins on `data` instead of being | ||
// passed by users. | ||
extensions: this.data('toMarkdownExtensions') || [] | ||
}) | ||
) | ||
} | ||
|
||
Object.assign(this, {Compiler: compiler}) | ||
} |
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
Oops, something went wrong.