Skip to content

Commit

Permalink
Refactor prose
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 13, 2020
1 parent 7ccaf99 commit 05d3e77
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.DS_Store
.nyc_output
*.log
node_modules
coverage
node_modules/
coverage/
/remark.js
/remark.min.js
yarn.lock
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Masahiro Miyashiro <3846masahiro+git@gmail.com>
Tom MacWright <tom@macwright.org> Tom MacWright <tmcw@users.noreply.github.com>
Min RK <benjaminrk@gmail.com> MinRK <benjaminrk@gmail.com>
Nick Baugh <niftylettuce@gmail.com>
Alex Leon <alexleon@domain.com.au>

# User names only.
anonymous (Niggler) <foo@bar.org>
Expand Down
16 changes: 8 additions & 8 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It’s built on [unified][], make sure to read it and its [website][] too.
## Contents

* [Intro](#intro)
* [Command-line](#command-line)
* [Command line](#command-line)
* [Using remark in a project](#using-remark-in-a-project)
* [Programmatic usage](#programmatic-usage)

Expand Down Expand Up @@ -104,9 +104,9 @@ The `--save-dev` option stores the dependencies in our `package.json`:
"name": "my-package",
"version": "1.0.0",
+ "devDependencies": {
+ "remark-cli": "^8.0.0",
+ "remark-html": "^12.0.0",
+ "remark-preset-lint-markdown-style-guide": "^3.0.0"
+ "remark-cli": "^9.0.0",
+ "remark-html": "^13.0.0",
+ "remark-preset-lint-markdown-style-guide": "^4.0.0"
+ },
"scripts": {
"test": "node test.js"
Expand All @@ -122,9 +122,9 @@ configuration:
"name": "my-package",
"version": "1.0.0",
"devDependencies": {
"remark-cli": "^8.0.0",
"remark-html": "^12.0.0",
"remark-preset-lint-markdown-style-guide": "^3.0.0"
"remark-cli": "^9.0.0",
"remark-html": "^13.0.0",
"remark-preset-lint-markdown-style-guide": "^4.0.0"
},
"scripts": {
- "test": "node test.js"
Expand Down Expand Up @@ -172,7 +172,7 @@ var report = require('vfile-reporter')
remark()
.use(styleGuide)
.use(html)
.process('_Hello_.', function(err, file) {
.process('_Hello_.', function (err, file) {
console.error(report(err || file))
console.log(String(file))
})
Expand Down
2 changes: 1 addition & 1 deletion doc/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ See [Creating plugins][create] below.
* [`remark-code-import`](https://github.com/kevin940726/remark-code-import)
— populate code blocks from files
* [`remark-code-screenshot`](https://github.com/Swizec/remark-code-screenshot)
– turn code blocks into carbon.now.sh screenshots
– turn code blocks into carbon.now\.sh screenshots
* [`remark-codesandbox`](https://github.com/kevin940726/remark-codesandbox)
– create CodeSandbox from code blocks
* [`remark-collapse`](https://github.com/Rokt33r/remark-collapse)
Expand Down
Empty file removed log.txt
Empty file.
32 changes: 4 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"typescript": "^4.0.0",
"unified": "^9.1.0",
"unified": "^9.0.0",
"unist-util-remove-position": "^3.0.0",
"xo": "^0.33.0"
},
"scripts": {
"postinstall": "lerna bootstrap --no-ci",
"format": "prettier . -w --loglevel warn && xo --fix",
"format": "./packages/remark-cli/cli.js . -qfo && 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",
Expand All @@ -56,39 +56,15 @@
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-type-error": "off",
"unicorn/prefer-reflect-apply": "off",
"unicorn/string-content": "off",
"complexity": "off",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"guard-for-in": "off",
"max-depth": "off",
"no-eq-null": "off"
},
"rules": {},
"ignores": [
"**/types",
"remark.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm",
[
"toc",
{
"heading": "contents"
}
]
"preset-wooorm"
]
}
}
49 changes: 26 additions & 23 deletions packages/remark-cli/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,35 @@ info on all available options.
```txt
Usage: remark [options] [path | glob ...]
CLI to process Markdown with remark using plugins
CLI to process Markdown with remark
Options:
-h --help output usage information
-v --version output version number
-o --output [path] specify output location
-r --rc-path <path> specify configuration file
-i --ignore-path <path> specify ignore file
-s --setting <settings> specify settings
-e --ext <extensions> specify extensions
-u --use <plugins> use plugins
-w --watch watch for changes and reprocess
-q --quiet output only warnings and errors
-S --silent output only errors
-f --frail exit with 1 on warnings
-t --tree specify input and output as syntax tree
--report <reporter> specify reporter
--file-path <path> specify path to process as
--tree-in specify input as syntax tree
--tree-out output syntax tree
--inspect output formatted syntax tree
--[no-]stdout specify writing to stdout (on by default)
--[no-]color specify color in report (on by default)
--[no-]config search for configuration files (on by default)
--[no-]ignore search for ignore files (on by default)
-h --help output usage information
-v --version output version number
-o --output [path] specify output location
-r --rc-path <path> specify configuration file
-i --ignore-path <path> specify ignore file
-s --setting <settings> specify settings
-e --ext <extensions> specify extensions
-u --use <plugins> use plugins
-w --watch watch for changes and reprocess
-q --quiet output only warnings and errors
-S --silent output only errors
-f --frail exit with 1 on warnings
-t --tree specify input and output as syntax tree
--report <reporter> specify reporter
--file-path <path> specify path to process as
--ignore-path-resolve-from dir|cwd resolve patterns in `ignore-path` from its directory or cwd
--ignore-pattern <globs> specify ignore patterns
--silently-ignore do not fail when given ignored files
--tree-in specify input as syntax tree
--tree-out output syntax tree
--inspect output formatted syntax tree
--[no-]stdout specify writing to stdout (on by default)
--[no-]color specify color in report (on by default)
--[no-]config search for configuration files (on by default)
--[no-]ignore search for ignore files (on by default)
Examples:
Expand Down
8 changes: 3 additions & 5 deletions packages/remark-parse/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

[Parser][] for [**unified**][unified].
Parses Markdown to [**mdast**][mdast] syntax trees.
Built on [micromark][].
Built on [`micromark`][micromark] and
[`mdast-util-from-markdown`][from-markdown].
Used in the [**remark** processor][remark] but can be used on its own as well.
Can be [extended][extend] to change how Markdown is parsed.

Expand All @@ -31,10 +32,7 @@ var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var html = require('rehype-stringify')

var processor = unified()
.use(markdown)
.use(remark2rehype)
.use(html)
var processor = unified().use(markdown).use(remark2rehype).use(html)

process.stdin.pipe(createStream(processor)).pipe(process.stdout)
```
Expand Down
4 changes: 3 additions & 1 deletion packages/remark-stringify/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ are supported and will be passed through.
## Extending the compiler

See [`mdast-util-to-markdown`][to-markdown].
Then create a wrapper plugin such as `remark-gfm`.
Then create a wrapper plugin such as [`remark-gfm`][remark-gfm].

## Security

Expand Down Expand Up @@ -206,3 +206,5 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
[to-markdown-options]: https://github.com/syntax-tree/mdast-util-to-markdown#formatting-options

[extend]: #extending-the-compiler

[remark-gfm]: https://github.com/remarkjs/remark-gfm
10 changes: 4 additions & 6 deletions packages/remark-stringify/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,7 @@ test('remark().stringify(ast, file)', function (t) {
['capitalized image references - shortcut', '![Bravo]']
]

tests.forEach(each)

st.end()

function each(test) {
tests.forEach(function (test) {
st.equal(
unified()
.use(parse)
Expand All @@ -328,7 +324,9 @@ test('remark().stringify(ast, file)', function (t) {
test[1] + '\n\n[bravo]: #\n',
test[0]
)
}
})

st.end()
})

t.test('should process associations without label', function (st) {
Expand Down
4 changes: 2 additions & 2 deletions packages/remark/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Yields:

###### Settings through data

This example prettifies Markdown and configures [`remark-parse`][parse] and
[`remark-stringify`][stringify] through [data][].
This example prettifies Markdown and configures [`remark-stringify`][stringify]
through [data][].

```js
var remark = require('remark')
Expand Down
8 changes: 5 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]

**remark** is a Markdown processor powered by [plugins][] part of the
[unified][] collective.
**remark** is a Markdown processor built on [micromark][] powered by
[plugins][] part of the [unified][] collective.

## Intro

Expand All @@ -25,7 +25,7 @@ contents (`remark-toc`)][remark-toc], or [compiling to man pages

Internally, remark now uses [**`micromark`**][micromark], a new, fast, and tiny
CommonMark compliant Markdown tokenizer.
It can be GFM compliant with `remark-gfm`.
It can be GFM compliant with [`remark-gfm`][remark-gfm].

Finally, remark is part of the [unified][website] [collective][governance].
Learn more about us:
Expand Down Expand Up @@ -203,3 +203,5 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
[sanitize]: https://github.com/rehypejs/rehype-sanitize

[micromark]: https://github.com/micromark/micromark

[remark-gfm]: https://github.com/remarkjs/remark-gfm

0 comments on commit 05d3e77

Please sign in to comment.