Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to use micromark #536

Merged
merged 11 commits into from Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 8 additions & 12 deletions doc/getting-started.md
Expand Up @@ -24,8 +24,6 @@ and written:
# Alpha #
Bravo charlie **delta** __echo__.
- Foxtrot
* Golf
+ Hotel
```

Yields:
Expand All @@ -35,14 +33,12 @@ Yields:

Bravo charlie **delta** **echo**.

- Foxtrot
- Golf
- Hotel
* Foxtrot
```

But, much more can be done, [through plugins][plugins].

## Command-line
## Command line

**remark**’s CLI is a simple way to process Markdown files from the
command line. Its interface is provided by [**unified-args**][unified-args].
Expand Down Expand Up @@ -108,9 +104,9 @@ The `--save-dev` option stores the dependencies in our `package.json`:
"name": "my-package",
"version": "1.0.0",
+ "devDependencies": {
+ "remark-cli": "^6.0.0",
+ "remark-html": "^8.0.0",
+ "remark-preset-lint-markdown-style-guide": "^2.0.0"
+ "remark-cli": "^8.0.0",
+ "remark-html": "^12.0.0",
+ "remark-preset-lint-markdown-style-guide": "^3.0.0"
+ },
"scripts": {
"test": "node test.js"
Expand All @@ -126,9 +122,9 @@ configuration:
"name": "my-package",
"version": "1.0.0",
"devDependencies": {
"remark-cli": "^6.0.0",
"remark-html": "^8.0.0",
"remark-preset-lint-markdown-style-guide": "^2.0.0"
"remark-cli": "^8.0.0",
"remark-html": "^12.0.0",
"remark-preset-lint-markdown-style-guide": "^3.0.0"
},
"scripts": {
- "test": "node test.js"
Expand Down
31 changes: 5 additions & 26 deletions doc/plugins.md
Expand Up @@ -38,8 +38,6 @@ See [Creating plugins][create] below.
— increase or decrease heading depth
* [`remark-bookmarks`](https://github.com/remarkjs/remark-bookmarks)
– automatic link manager
* [`remark-bracketed-spans`](https://github.com/sethvincent/remark-bracketed-spans)
– custom syntax for id’s, classes, and data attributes to spans of text
* [`remark-breaks`](https://github.com/remarkjs/remark-breaks)
– support hard breaks without needing spaces (like on issues)
* [`remark-capitalize`](https://github.com/zeit/remark-capitalize)
Expand Down Expand Up @@ -83,8 +81,6 @@ See [Creating plugins][create] below.
— embed local images as base64-encoded data URIs
* [`remark-emoji`](https://github.com/rhysd/remark-emoji)
— transform Gemoji short-codes to emoji
* [`remark-emoji-to-gemoji`](https://github.com/jackycute/remark-emoji-to-gemoji)
— transform emoji to Gemoji short-codes
* [`remark-external-links`](https://github.com/remarkjs/remark-external-links)
— add `target` and `rel` attributes to external links
* [`remark-extract-frontmatter`](https://github.com/mrzmmr/remark-extract-frontmatter)
Expand All @@ -101,20 +97,14 @@ See [Creating plugins][create] below.
– support frontmatter (yaml, toml, and more)
* [`remark-gemoji`](https://github.com/remarkjs/remark-gemoji)
— better support for Gemoji shortcodes
* [`remark-gemoji-to-emoji`](https://github.com/jackycute/remark-gemoji-to-emoji)
— transform Gemoji shortcodes to emoji
* [`remark-generic-extensions`](https://github.com/medfreeman/remark-generic-extensions)
— custom syntax for the CommonMark generic directive extension
* [`remark-git-contributors`](https://github.com/remarkjs/remark-git-contributors)
— add a table of contributors based on Git history, options, and more
* [`remark-github`](https://github.com/remarkjs/remark-github)
— autolink references to commits, issues, pull-requests, and users
* [`remark-gitlab-artifact`](https://github.com/temando/remark-gitlab-artifact)
— download artifacts from GitLab projects to live alongside your docs
* [`remark-grid-tables`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-grid-tables#readme)
— custom syntax to describe tables (rehype compatible)
* [`remark-graphviz`](https://github.com/temando/remark-graphviz)
— transform [graphviz](https://www.graphviz.org) dot graphs to SVG
* [`remark-heading-id`](https://github.com/imcuttle/remark-heading-id)
— custom heading id support `{#custom-id}`
* [`remark-heading-gap`](https://github.com/remarkjs/remark-heading-gap)
Expand All @@ -126,9 +116,7 @@ See [Creating plugins][create] below.
— add hints/tips/warnings to markdown
* [`remark-html`](https://github.com/remarkjs/remark-html)
— serialize Markdown as HTML
* [`remark-html-emoji-image`](https://github.com/jackycute/remark-html-emoji-image)
— transform emoji to images
* [`remark-html-katex`](https://github.com/Rokt33r/remark-math/tree/HEAD/packages/remark-html-katex#readme)
* [`remark-html-katex`](https://github.com/remarkjs/remark-math/tree/HEAD/packages/remark-html-katex#readme)
— change inline and block math to equations with [KaTeX](https://github.com/Khan/KaTeX)
* [`remark-iframes`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-iframes#readme)
— custom syntax to create iframes (new node type, rehype compatible)
Expand All @@ -155,14 +143,10 @@ See [Creating plugins][create] below.
— support for block macros (new node types, rehype compatible)
* [`remark-man`](https://github.com/remarkjs/remark-man)
— serialize Markdown as man pages (roff)
* [`remark-math`](https://github.com/Rokt33r/remark-math)
* [`remark-math`](https://github.com/remarkjs/remark-math)
— custom syntax for math (new node types, rehype compatible)
* [`remark-mermaid`](https://github.com/temando/remark-mermaid)
— transform [mermaid](https://mermaidjs.github.io/) graphs to SVG
* [`remark-message-control`](https://github.com/remarkjs/remark-message-control)
— turn some or all messages on or off
* [`remark-metadata`](https://github.com/temando/remark-metadata)
— add metadata about the processed file as front matter
* [`remark-midas`](https://github.com/remarkjs/remark-midas)
— highlight CSS code blocks with [midas](https://github.com/ben-eb/midas)
(rehype compatible)
Expand All @@ -174,8 +158,6 @@ See [Creating plugins][create] below.
— transform URLs for youtube, twitter, etc. embeds
* [`remark-oembed`](https://github.com/sergioramos/remark-oembed)
— transform URLs surrounded by newlines into *asynchronously* loaded embeds
* [`remark-openapi`](https://github.com/temando/remark-openapi)
— transform links to local or remote OpenAPI definitions to tables
* [`remark-package-dependencies`](https://github.com/unlight/remark-package-dependencies)
— inject your dependencies
* [`remark-parse-yaml`](https://github.com/landakram/remark-parse-yaml)
Expand All @@ -190,8 +172,6 @@ See [Creating plugins][create] below.
— compile Markdown to [React](https://github.com/facebook/react)
* [`remark-react-codemirror`](https://github.com/craftzdog/remark-react-codemirror)
— highlight code blocks for **remark-react** with [CodeMirror](https://codemirror.net)
* [`remark-react-lowlight`](https://github.com/inlinestyle/remark-react-lowlight)
— highlight code blocks for **remark-react** with [lowlight](https://github.com/wooorm/lowlight)
* [`remark-redact`](https://github.com/seafoam6/remark-redact)
— conceal text matching a regex
* [`remark-redactable`](https://github.com/code-dot-org/remark-redactable)
Expand Down Expand Up @@ -287,11 +267,10 @@ virtual files.

## Using plugins

To use a plugin programmatically, invoke the [`use()`][unified-use]
function.
To use a plugin programmatically, call the [`use()`][unified-use] function.

To use plugin with `remark-cli`, pass a [`--use` flag][unified-args-use]
or specify it in a [configuration file][config-file-use].
To use plugin with `remark-cli`, pass a [`--use` flag][unified-args-use] or
specify it in a [configuration file][config-file-use].

## Creating plugins

Expand Down
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
(The MIT License)

Copyright (c) 2014-2016 Titus Wormer <tituswormer@gmail.com>
Copyright (c) 2014-2020 Titus Wormer <tituswormer@gmail.com>
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Empty file added log.txt
Empty file.
16 changes: 4 additions & 12 deletions package.json
Expand Up @@ -10,39 +10,32 @@
"url": "https://opencollective.com/unified"
},
"devDependencies": {
"bail": "^1.0.0",
"browserify": "^16.0.0",
"camelcase": "^6.0.0",
"clone": "^2.0.0",
"dtslint": "^4.0.0",
"execa": "^4.0.0",
"lerna": "^3.0.0",
"mdast-util-assert": "^3.0.0",
"mdast-util-compact": "^2.0.0",
"mdast-zone": "^4.0.0",
"mdast-util-gfm": "^0.1.0",
"micromark-extension-gfm": "^0.3.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"remark-preset-wooorm": "^7.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"typescript": "^4.0.0",
"unified": "^9.1.0",
"unist-builder": "^2.0.0",
"unist-util-remove-position": "^3.0.0",
"unist-util-visit": "^2.0.0",
"vfile": "^4.0.0",
"wcwidth": "^1.0.0",
"xo": "^0.33.0"
},
"scripts": {
"postinstall": "lerna bootstrap --no-ci",
"format": "packages/remark-cli/cli.js . -qfo && prettier . --write && xo --fix",
"format": "prettier . -w --loglevel warn && xo --fix",
"build-bundle": "browserify packages/remark -s remark > remark.js",
"build-mangle": "browserify packages/remark -s remark -p tinyify > remark.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "tape \"packages/*/test.js\" \"test/index.js\"",
"test-api-extensive": "TEST_EXTENDED=true npm run test-api",
"test-coverage": "nyc --reporter lcov tape \"test/index.js\" \"packages/*/test.js\"",
"test-coverage": "nyc --reporter lcov tape \"packages/*/test.js\" \"test/index.js\"",
"test-types": "dtslint packages/remark-parse/types && dtslint packages/remark-stringify/types && dtslint packages/remark/types",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
},
Expand Down Expand Up @@ -89,7 +82,6 @@
},
"remarkConfig": {
"plugins": [
"./script/list-of-methods",
"preset-wooorm",
[
"toc",
Expand Down
4 changes: 2 additions & 2 deletions packages/remark-cli/package.json
@@ -1,6 +1,6 @@
{
"name": "remark-cli",
"version": "8.0.1",
"version": "9.0.0-alpha.1",
"description": "CLI to process Markdown with remark",
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -30,7 +30,7 @@
],
"dependencies": {
"markdown-extensions": "^1.1.0",
"remark": "^12.0.0",
"remark": "^13.0.0-alpha.1",
"unified-args": "^8.0.0"
},
"scripts": {
Expand Down
94 changes: 47 additions & 47 deletions packages/remark-cli/readme.md
Expand Up @@ -17,53 +17,6 @@ Command line interface for [**remark**][remark].
* Uses configuration from [`remarkConfig` fields in `package.json`
files][config-file]

## Sponsors

Support this effort and give back by sponsoring on [OpenCollective][collective]!

<!--lint ignore no-html-->

<table>
<tr valign="middle">
<td width="20%" align="center" colspan="2">
<a href="https://www.gatsbyjs.org">Gatsby</a> 🥇<br><br>
<a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" colspan="2">
<a href="https://vercel.com">Vercel</a> 🥇<br><br>
<a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" colspan="2">
<a href="https://www.netlify.com">Netlify</a><br><br>
<!--OC has a sharper image-->
<a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
<a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://themeisle.com">ThemeIsle</a><br><br>
<a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boostio.co">BoostIO</a><br><br>
<a href="https://boostio.co"><img src="https://avatars1.githubusercontent.com/u/13612118?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://expo.io">Expo</a><br><br>
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
</td>
</tr>
</table>

## Install

[npm][]:
Expand Down Expand Up @@ -154,6 +107,53 @@ This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.

## Sponsor

Support this effort and give back by sponsoring on [OpenCollective][collective]!

<!--lint ignore no-html-->

<table>
<tr valign="middle">
<td width="20%" align="center" colspan="2">
<a href="https://www.gatsbyjs.org">Gatsby</a> 🥇<br><br>
<a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" colspan="2">
<a href="https://vercel.com">Vercel</a> 🥇<br><br>
<a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" colspan="2">
<a href="https://www.netlify.com">Netlify</a><br><br>
<!--OC has a sharper image-->
<a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
<a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://themeisle.com">ThemeIsle</a><br><br>
<a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boostio.co">BoostIO</a><br><br>
<a href="https://boostio.co"><img src="https://avatars1.githubusercontent.com/u/13612118?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://expo.io">Expo</a><br><br>
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
</td>
</tr>
</table>

## License

[MIT][license] © [Titus Wormer][author]
Expand Down
25 changes: 16 additions & 9 deletions packages/remark-parse/index.js
@@ -1,17 +1,24 @@
'use strict'

var unherit = require('unherit')
var xtend = require('xtend')
var Parser = require('./lib/parser.js')

module.exports = parse
parse.Parser = Parser

var fromMarkdown = require('mdast-util-from-markdown')

function parse(options) {
var settings = this.data('settings')
var Local = unherit(Parser)
var self = this

Local.prototype.options = xtend(Local.prototype.options, settings, options)
this.Parser = parse

this.Parser = Local
function parse(doc) {
return fromMarkdown(
doc,
Object.assign({}, self.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: self.data('micromarkExtensions') || [],
mdastExtensions: self.data('fromMarkdownExtensions') || []
})
)
}
}