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 1 commit
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
7 changes: 3 additions & 4 deletions doc/plugins.md
Expand Up @@ -287,11 +287,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
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
22 changes: 13 additions & 9 deletions packages/remark-parse/index.js
@@ -1,17 +1,21 @@
'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) {
var settings = 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.
settings.extensions = settings.micromarkExtensions
settings.mdastExtensions = settings.fromMarkdownExtensions
return fromMarkdown(doc, settings)
}
}
70 changes: 0 additions & 70 deletions packages/remark-parse/lib/block-elements.js

This file was deleted.

58 changes: 0 additions & 58 deletions packages/remark-parse/lib/decode.js

This file was deleted.