Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: remarkjs/remark
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 14.0.2
Choose a base ref
...
head repository: remarkjs/remark
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 14.0.3
Choose a head ref

Commits on Nov 18, 2021

  1. remark-cli: 10.0.1

    wooorm committed Nov 18, 2021
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3d37955 View commit details

Commits on Nov 23, 2021

  1. Add remark-prettier to list of plugin

    Closes GH-906.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    remcohaszing authored Nov 23, 2021
    1
    Copy the full SHA
    39b680e View commit details

Commits on Nov 24, 2021

  1. Fix typo

    wooorm authored Nov 24, 2021
    1
    Copy the full SHA
    f679aa2 View commit details

Commits on Nov 28, 2021

  1. Add remark-mermaidjs to list of plugins

    Closes GH-907.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    remcohaszing authored Nov 28, 2021
    1
    Copy the full SHA
    dc54789 View commit details

Commits on Dec 23, 2021

  1. Add @vcarl/remark-headings to list of plugins

    Closes GH-928.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    vcarl authored Dec 23, 2021
    1
    Copy the full SHA
    13734ff View commit details

Commits on Jan 13, 2022

  1. Add remark-docx and remark-pdf to list of plugins

    Closes GH-933.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    inokawa authored Jan 13, 2022
    1
    Copy the full SHA
    9dfc5cb View commit details

Commits on Jan 19, 2022

  1. Fix typos

    wooorm authored Jan 19, 2022
    1
    Copy the full SHA
    68ea9f4 View commit details

Commits on Jan 29, 2022

  1. Update dev-dependencies

    wooorm committed Jan 29, 2022
    1
    Copy the full SHA
    d22f9d5 View commit details
  2. Update sponsors

    wooorm committed Jan 29, 2022
    1
    Copy the full SHA
    5fcde5d View commit details

Commits on Feb 25, 2022

  1. Add canary workflow

    Closes GH-958.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    ChristianMurphy authored Feb 25, 2022
    1
    Copy the full SHA
    5730ad2 View commit details

Commits on Apr 1, 2022

  1. Update dev-dependencies

    wooorm committed Apr 1, 2022
    1
    Copy the full SHA
    1a9e75c View commit details
  2. Replace skypack w/ esm.sh

    wooorm committed Apr 1, 2022
    1
    Copy the full SHA
    c0e8586 View commit details

Commits on May 29, 2022

  1. Update dev-dependencies

    wooorm committed May 29, 2022
    Copy the full SHA
    acce1ab View commit details
  2. Add remark-github-beta-blockquote-admonitions to list of plugins

    Closes GH-1000.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    myl7 authored May 29, 2022
    1
    Copy the full SHA
    fba413a View commit details

Commits on Jun 24, 2022

  1. Remove support for Node.js 12 in CLI

    Closes GH-1007.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    remcohaszing authored Jun 24, 2022
    1
    Copy the full SHA
    56eb9ed View commit details
  2. Update unified-args

    Closes GH-1008.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    remcohaszing authored Jun 24, 2022
    1
    Copy the full SHA
    145019c View commit details

Commits on Jun 25, 2022

  1. Update dev-dependencies

    wooorm committed Jun 25, 2022
    1
    Copy the full SHA
    cba99d6 View commit details
  2. Add example of typing a plugin

    wooorm committed Jun 25, 2022
    1
    Copy the full SHA
    f20f9d5 View commit details
  3. remark-cli: 11.0.0

    wooorm committed Jun 25, 2022
    1
    Copy the full SHA
    99179c6 View commit details

Commits on Oct 9, 2022

  1. Remove deprecated remark-jargon

    Use `rehype-jargon` instead.
    
    Closes GH-1059..
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    LunaticMuch authored Oct 9, 2022
    1
    Copy the full SHA
    c7e8171 View commit details

Commits on Oct 31, 2022

  1. Add 3 plugins to list of plugins

    Closes GH-1064.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    Xunnamius authored Oct 31, 2022
    1
    Copy the full SHA
    0d1eb09 View commit details

Commits on Nov 17, 2022

  1. Update dev-dependencies

    wooorm committed Nov 17, 2022
    1
    Copy the full SHA
    dc51075 View commit details
  2. Fix internal types for TS 4.9

    wooorm committed Nov 17, 2022
    1
    Copy the full SHA
    974f893 View commit details
  3. Update Actions

    Closes GH-1070.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    ChristianMurphy authored Nov 17, 2022
    1
    Copy the full SHA
    134ece2 View commit details

Commits on Dec 26, 2022

  1. Add remark-code-title to list of plugins

    Closes GH-106.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    kevinzunigacuellar authored Dec 26, 2022
    1
    Copy the full SHA
    9af1a87 View commit details
  2. 1
    Copy the full SHA
    28aa8b9 View commit details

Commits on Jan 12, 2023

  1. Add ignore-scripts to .npmrc

    Closes GH-1103.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    ChristianMurphy authored Jan 12, 2023
    1
    Copy the full SHA
    f07f413 View commit details

Commits on Jan 17, 2023

  1. Update tsconfig.json to use node16 module resolution

    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    
    Closes GH-1106.
    ChristianMurphy authored Jan 17, 2023
    1
    Copy the full SHA
    bec44aa View commit details

Commits on Feb 10, 2023

  1. Add remark-cloudinary-docusaurus to list of plugins

    Closes GH-1090.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    johnnyreilly authored Feb 10, 2023
    1
    Copy the full SHA
    32d6948 View commit details
  2. Add remark-flexible-code-titles to list of plugins

    Closes GH-1108.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    talatkuyuk authored Feb 10, 2023
    1
    Copy the full SHA
    20e7543 View commit details

Commits on Feb 26, 2023

  1. Add remark-flexible-containers to list of plugins

    Closes GH-1112.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    talatkuyuk authored Feb 26, 2023
    1
    Copy the full SHA
    6aa638a View commit details

Commits on Feb 28, 2023

  1. Add remark-flexible-paragraphs to list of plugins

    Closes GH-1120.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    talatkuyuk authored Feb 28, 2023
    1
    Copy the full SHA
    42114fc View commit details

Commits on Mar 10, 2023

  1. Add remark-flexible-markers to list of plugins

    Closes GH-1126.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    talatkuyuk authored Mar 10, 2023
    1
    Copy the full SHA
    e456dc5 View commit details

Commits on Mar 30, 2023

  1. Add remark-ins to list of plugins

    Closes GH-1129.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    talatkuyuk authored Mar 30, 2023
    1
    Copy the full SHA
    1e488d0 View commit details

Commits on May 9, 2023

  1. Add improved docs on what this project is

    Closes GH-1147.
    
    Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    BeLi4L authored May 9, 2023
    1
    Copy the full SHA
    bb4c814 View commit details
  2. Update dev-dependencies

    wooorm committed May 9, 2023
    1
    Copy the full SHA
    e69e55f View commit details

Commits on May 16, 2023

  1. 1
    Copy the full SHA
    f6bd64e View commit details
  2. Use Node test runner

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    f4ac350 View commit details
  3. Refactor script

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    5953d61 View commit details
  4. Update Node in Actions

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    aa0b05b View commit details
  5. remark-stringify: 10.0.3

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    652ad19 View commit details
  6. remark-parse: 10.0.2

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    4178acc View commit details
  7. 14.0.3

    wooorm committed May 16, 2023
    1
    Copy the full SHA
    43542c3 View commit details
48 changes: 43 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -7,16 +7,54 @@ jobs:
name: ${{matrix.node}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dcodeIO/setup-node-nvm@master
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- run: npm install -g npm
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
strategy:
matrix:
node:
- lts/erbium
- lts/gallium
- node
canary:
name: canary / ${{matrix.package}} / ${{matrix.node}} on ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- name: checkout remark
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- name: setup remark
run: |
npm install -g npm
npm install
npm run build
- name: checkout ${{matrix.package}}
uses: actions/checkout@v3
with:
repository: ${{matrix.package}}
path: canary/${{matrix.package}}
- name: test ${{matrix.package}}
run: |
npm install
for package in $(ls ../../packages); do
npx rimraf "node_modules/**/$package"
done
npm test
working-directory: canary/${{matrix.package}}
strategy:
fail-fast: false
max-parallel: 2
matrix:
os:
- ubuntu-latest
node:
- node
package:
- remarkjs/remark-gfm
- remarkjs/react-markdown
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
ignore-scripts=true
43 changes: 41 additions & 2 deletions doc/plugins.md
Original file line number Diff line number Diff line change
@@ -50,8 +50,13 @@ The list of plugins:
– hard breaks w/o needing spaces (like on issues)
* 🟢 [`remark-capitalize`](https://github.com/zeit/remark-capitalize)
– transform all titles w/ [`title.sh`](https://github.com/zeit/title)
* 🟢 [`remark-capitalize-headings`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-capitalize-headings)
– selectively capitalize headings
(👉 **note**: alternative to [`remark-capitalize`](https://github.com/zeit/remark-capitalize))
* 🟢 [`remark-cite`](https://github.com/benrbray/remark-cite)
– new syntax for Pandoc-style citations
* 🟢 [`remark-cloudinary-docusaurus`](https://github.com/johnnyreilly/remark-cloudinary-docusaurus)
– allows Docusaurus to use Cloudinary to serve optimised images
* 🟢 [`remark-code-blocks`](https://github.com/mrzmmr/remark-code-blocks)
— select and store code blocks
* 🟢 [`remark-code-extra`](https://github.com/samlanning/remark-code-extra)
@@ -93,6 +98,8 @@ The list of plugins:
— new syntax for directives (generic extensions)
* 🟢 [`remark-directive-rehype`](https://github.com/IGassmann/remark-directive-rehype)
— turn [directives][d] into HTML custom elements (rehype compatible)
* 🟢 [`remark-docx`](https://github.com/inokawa/remark-docx)
— compile markdown to docx
* 🟢 [`remark-dropcap`](https://github.com/brev/remark-dropcap)
— fancy and accessible drop caps
* 🟢 [`remark-embed-images`](https://github.com/remarkjs/remark-embed-images)
@@ -107,6 +114,14 @@ The list of plugins:
— change the first heading in a document
* 🟢 [`remark-fix-guillemets`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-fix-guillemets#readme)
— support ASCII guillements (`<<`, `>>`) mapping them to HTML
* 🟢 [`remark-flexible-code-titles`](https://github.com/ipikuka/remark-flexible-code-titles)
— add titles or/and containers for code blocks with customizable attributes
* 🟢 [`remark-flexible-containers`](https://github.com/ipikuka/remark-flexible-containers)
— add custom/flexible containers with customizable properties
* 🟢 [`remark-flexible-markers`](https://github.com/ipikuka/remark-flexible-markers)
— add custom/flexible mark element with customizable properties
* 🟢 [`remark-flexible-paragraphs`](https://github.com/ipikuka/remark-flexible-paragraphs)
— add custom/flexible paragraphs with customizable properties
* 🟢 [`remark-frontmatter`](https://github.com/remarkjs/remark-frontmatter)
– support frontmatter (yaml, toml, and more)
* 🟢 [`remark-gemoji`](https://github.com/remarkjs/remark-gemoji)
@@ -121,12 +136,16 @@ The list of plugins:
— 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-github-beta-blockquote-admonitions`](https://github.com/myl7/remark-github-beta-blockquote-admonitions)
[GitHub beta blockquote-based admonitions](https://github.com/github/feedback/discussions/16925)
* ⚠️ [`remark-grid-tables`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-grid-tables#readme)
— new syntax to describe tables (rehype compatible)
* 🟢 [`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)
— serialize w/ more blank lines between headings
* 🟢 [`@vcarl/remark-headings`](https://github.com/vcarl/remark-headings)
— extract a list of headings as data
* 🟢 [`remark-highlight.js`](https://github.com/remarkjs/remark-highlight.js)
— highlight code blocks w/ [highlight.js](https://github.com/isagalaev/highlight.js)
(rehype compatible)
@@ -136,14 +155,16 @@ The list of plugins:
— serialize markdown as HTML
* ⚠️ [`remark-iframes`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-iframes#readme)
— new syntax to create iframes (new node type, rehype compatible)
* 🟢 [`remark-ignore`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-ignore)
— use comments to exclude nodes from transformation
* 🟢 [`remark-images`](https://github.com/remarkjs/remark-images)
— add an improved image syntax
* 🟢 [`remark-img-links`](https://github.com/Pondorasti/remark-img-links)
— prefix relative image paths with an absolute URL
* 🟢 [`remark-inline-links`](https://github.com/remarkjs/remark-inline-links)
— change references and definitions to links and images
* 🟢 [`remark-jargon`](https://github.com/freesewing/freesewing/tree/develop/packages/remark-jargon)
inserts definitions for jargon terms
* 🟢 [`remark-ins`](https://github.com/ipikuka/remark-ins)
add ins element for inserted texts opposite to deleted texts
* 🟢 [`remark-join-cjk-lines`](https://github.com/purefun/remark-join-cjk-lines)
— remove extra space between CJK Characters.
* ⚠️ [`remark-kbd`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-kbd#readme)
@@ -165,6 +186,8 @@ The list of plugins:
— new syntax for math (new node types, rehype compatible)
* 🟢 [`remark-mdx`](https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx)
— support MDX (JSX, expressions, ESM)
* 🟢 [`remark-mermaidjs`](https://github.com/remcohaszing/remark-mermaidjs)
— transform mermaid code blocks into inline SVGs
* 🟢 [`remark-message-control`](https://github.com/remarkjs/remark-message-control)
— turn some or all messages on or off
* 🟢 [`remark-normalize-headings`](https://github.com/remarkjs/remark-normalize-headings)
@@ -180,9 +203,13 @@ The list of plugins:
— inject your dependencies
* ⚠️ [`remark-parse-yaml`](https://github.com/landakram/remark-parse-yaml)
— parse YAML nodes and expose their value as `parsedValue`
* 🟢 [`remark-pdf`](https://github.com/inokawa/remark-pdf)
— compile markdown to pdf
* ⚠️ [`remark-ping`](https://github.com/zestedesavoir/zmarkdown/tree/HEAD/packages/remark-ping#readme)
— new syntax for mentions w/ configurable existence check (new node
type, rehype compatible)
* 🟢 [`remark-prettier`](https://github.com/remcohaszing/remark-prettier)
— check and format markdown using Prettier
* 🟢 [`remark-prism`](https://github.com/sergioramos/remark-prism)
— highlight code blocks w/ [Prism](https://prismjs.com/) (supporting most
Prism plugins)
@@ -199,6 +226,12 @@ The list of plugins:
— change absolute URLs to relative ones
* 🟢 [`remark-remove-comments`](https://github.com/alvinometric/remark-remove-comments)
— remove HTML comments from the processed output
* 🟢 [`remark-remove-unused-definitions`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-remove-unused-definitions)
— remove unused reference-style link definitions
* 🟢 [`remark-remove-url-trailing-slash`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-remove-url-trailing-slash)
— remove trailing slashes from the ends of all URL paths
* 🟢 [`remark-renumber-references`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-renumber-references)
— renumber numeric reference-style link ids contiguously starting from 1
* 🟢 [`remark-retext`](https://github.com/remarkjs/remark-retext)
— transform to [retext](https://github.com/retextjs/retext)
* 🟢 [`remark-ruby`](https://github.com/laysent/remark-ruby)
@@ -220,6 +253,8 @@ The list of plugins:
— SmartyPants
* 🟢 [`remark-smcat`](https://github.com/shedali/remark-smcat)
— state machine cat
* 🟢 [`remark-sort-definitions`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-sort-definitions)
— reorder reference-style link definitions
* 🟢 [`remark-sources`](https://github.com/unlight/remark-sources)
— insert source code
* 🟢 [`remark-strip-badges`](https://github.com/remarkjs/remark-strip-badges)
@@ -235,6 +270,8 @@ The list of plugins:
— new customizable syntax for special terms and phrases
* 🟢 [`remark-textr`](https://github.com/remarkjs/remark-textr)
— transform text w/ [`Textr`](https://github.com/shuvalov-anton/textr)
* 🟢 [`remark-tight-comments`](https://github.com/Xunnamius/unified-utils/blob/main/packages/remark-tight-comments)
— selectively remove newlines around comments
* 🟢 [`remark-title`](https://github.com/RichardLitt/remark-title)
— check and add the document title
* 🟢 [`remark-toc`](https://github.com/remarkjs/remark-toc)
@@ -273,6 +310,8 @@ The list of plugins:
— new syntax for wiki links (rehype compatible)
* 🟢 [`remark-yaml-config`](https://github.com/remarkjs/remark-yaml-config)
— configure remark w/ YAML
* 🟢 [`remark-code-title`](https://github.com/kevinzunigacuellar/remark-code-title)
— add titles to code blocks

## List of presets

30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -11,35 +11,35 @@
},
"type": "module",
"workspaces": [
"packages/remark-parse",
"packages/remark-stringify",
"packages/remark",
"packages/remark-cli"
"packages/remark-parse/",
"packages/remark-stringify/",
"packages/remark/",
"packages/remark-cli/"
],
"devDependencies": {
"@types/mdast": "^3.0.0",
"@types/tape": "^4.0.0",
"@types/node": "^20.0.0",
"c8": "^7.0.0",
"camelcase": "^6.0.0",
"execa": "^6.0.0",
"camelcase": "^7.0.0",
"execa": "^7.0.0",
"mdast-util-assert": "^4.0.0",
"mdast-util-gfm": "^2.0.0",
"micromark-extension-gfm": "^2.0.0",
"prettier": "^2.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"unified": "^10.0.0",
"unist-util-remove-position": "^4.0.0",
"xo": "^0.46.0"
"xo": "^0.54.0"
},
"scripts": {
"build": "npm run build --workspaces && rimraf \"*.d.ts\" \"{test,script}/**/*.d.ts\" && tsc && type-coverage",
"prepack": "npm run build && npm run format",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "./packages/remark-cli/cli.js . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "npm run test --workspaces && node --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
@@ -55,7 +55,11 @@
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
"remark-preset-wooorm",
[
"remark-lint-no-html",
false
]
]
},
"typeCoverage": {
1 change: 1 addition & 0 deletions packages/remark-cli/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
import {createRequire} from 'node:module'
import {args} from 'unified-args'
// eslint-disable-next-line import/order
import {remark} from 'remark'

const require = createRequire(import.meta.url)
5 changes: 2 additions & 3 deletions packages/remark-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remark-cli",
"version": "10.0.0",
"version": "11.0.0",
"description": "Command line interface to inspect and change markdown files with remark",
"license": "MIT",
"keywords": [
@@ -32,10 +32,9 @@
],
"dependencies": {
"remark": "^14.0.0",
"unified-args": "^9.0.0"
"unified-args": "^10.0.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"test": "node --conditions development test.js"
},
"xo": false,
38 changes: 20 additions & 18 deletions packages/remark-cli/readme.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ If not, you can always use [`remark`][remark-core] itself manually in a script.
## Install

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
In Node.js (version 14.14+, or 16.0+), install with [npm][]:

```sh
npm install remark-cli
@@ -268,20 +268,20 @@ The order of precedence is as follows.
Earlier wins (so in the above file structure `folder/.remarkrc.js` wins over
`folder/package.json`):

1. `.remarkc` (JSON)
2. `.remarkc.json` (JSON)
3. `.remarkc.cjs` (CJS)
4. `.remarkc.mjs` (ESM)
5. `.remarkc.js` (CJS or ESM, depending on `type: 'module'` in `package.json`)
6. `.remarkc.yaml` (YAML)
7. `.remarkc.yml` (YAML)
1. `.remarkrc` (JSON)
2. `.remarkrc.json` (JSON)
3. `.remarkrc.cjs` (CJS)
4. `.remarkrc.mjs` (ESM)
5. `.remarkrc.js` (CJS or ESM, depending on `type: 'module'` in `package.json`)
6. `.remarkrc.yaml` (YAML)
7. `.remarkrc.yml` (YAML)
8. `package.json` with `remarkConfig` field

## Compatibility

Projects maintained by the unified collective are compatible with all maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
As of now, that is Node.js 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.

## Security
@@ -327,19 +327,23 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://www.hashicorp.com">HashiCorp</a><br><br>
<a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" colspan="2">
<a href="https://www.gitbook.com">GitBook</a><br><br>
<a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="10%" align="center">
<a href="https://www.coinbase.com">Coinbase</a><br><br>
<a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a>
@@ -353,8 +357,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boosthub.io">Boost Hub</a><br><br>
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
<a href="https://boostnote.io">Boost Note</a><br><br>
<a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
@@ -363,11 +367,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<td width="100%" align="center" colspan="8">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
137 changes: 66 additions & 71 deletions packages/remark-cli/test.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,77 @@
import {URL, fileURLToPath} from 'node:url'
import assert from 'node:assert/strict'
import {fileURLToPath} from 'node:url'
import test from 'node:test'
import {execa} from 'execa'
import test from 'tape'

test('remark-cli', (t) => {
t.plan(2)
test('remark-cli', async (t) => {
await t.test('should show help on `--help`', async () => {
const bin = fileURLToPath(new URL('cli.js', import.meta.url))

t.test('should show help on `--help`', (t) => {
const bin = fileURLToPath(new URL('./cli.js', import.meta.url))
const result = await execa(bin, ['--help'])

t.plan(1)

execa(bin, ['--help']).then((result) => {
t.equal(
result.stdout,
[
'Usage: remark [options] [path | glob ...]',
'',
' Command line interface to inspect and change markdown files 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',
' --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:',
'',
' # Process `input.md`',
' $ remark input.md -o output.md',
'',
' # Pipe',
' $ remark < input.md > output.md',
'',
' # Rewrite all applicable files',
' $ remark . -o'
].join('\n'),
'should show help'
)
})
assert.equal(
result.stdout,
[
'Usage: remark [options] [path | glob ...]',
'',
' Command line interface to inspect and change markdown files 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',
' --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:',
'',
' # Process `input.md`',
' $ remark input.md -o output.md',
'',
' # Pipe',
' $ remark < input.md > output.md',
'',
' # Rewrite all applicable files',
' $ remark . -o'
].join('\n'),
'should show help'
)
})

t.test('should show version on `--version`', (t) => {
const bin = fileURLToPath(new URL('./cli.js', import.meta.url))
await t.test('should show version on `--version`', async () => {
const bin = fileURLToPath(new URL('cli.js', import.meta.url))

t.plan(2)
const result = await execa(bin, ['--version'])

execa(bin, ['--version']).then((result) => {
t.ok(
/remark: \d+\.\d+\.\d+/.test(result.stdout),
'should include remark version'
)
assert.ok(
/remark: \d+\.\d+\.\d+/.test(result.stdout),
'should include remark version'
)

t.ok(
/remark-cli: \d+\.\d+\.\d+/.test(result.stdout),
'should include remark-cli version'
)
})
assert.ok(
/remark-cli: \d+\.\d+\.\d+/.test(result.stdout),
'should include remark-cli version'
)
})
})
2 changes: 1 addition & 1 deletion packages/remark-cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["*.js"]
"references": [{"path": "../remark/"}]
}
5 changes: 3 additions & 2 deletions packages/remark-parse/index.d.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import type {Root} from 'mdast'
import type {Plugin} from 'unified'
import type {Options} from './lib/index.js'

declare const remarkParse: Plugin<[Options?] | void[], string, Root>
declare const remarkParse: Plugin<[(Options | undefined)?], string, Root>
export default remarkParse
export type {Options}

export type {Options} from './lib/index.js'
4 changes: 1 addition & 3 deletions packages/remark-parse/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import remarkParse from './lib/index.js'

export default remarkParse
export {default} from './lib/index.js'
5 changes: 4 additions & 1 deletion packages/remark-parse/lib/index.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,10 @@

import {fromMarkdown} from 'mdast-util-from-markdown'

/** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */
/**
* @this {import('unified').Processor}
* @type {import('unified').Plugin<[Options?] | void[], string, Root>}
*/
export default function remarkParse(options) {
/** @type {import('unified').ParserFunction<Root>} */
const parser = (doc) => {
5 changes: 2 additions & 3 deletions packages/remark-parse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remark-parse",
"version": "10.0.1",
"version": "10.0.2",
"description": "remark plugin to add support for parsing markdown input",
"license": "MIT",
"keywords": [
@@ -46,8 +46,7 @@
"unified": "^10.0.0"
},
"scripts": {
"test": "node --conditions development test.js",
"build": "rimraf \"test.d.ts\" \"lib/**/*.d.ts\" && tsc && type-coverage"
"test": "node --conditions development test.js"
},
"xo": false,
"typeCoverage": {
30 changes: 16 additions & 14 deletions packages/remark-parse/readme.md
Original file line number Diff line number Diff line change
@@ -77,17 +77,17 @@ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
npm install remark-parse
```

In Deno with [Skypack][]:
In Deno with [`esm.sh`][esmsh]:

```js
import remarkParse from 'https://cdn.skypack.dev/remark-parse@10?dts'
import remarkParse from 'https://esm.sh/remark-parse@10'
```

In browsers with [Skypack][]:
In browsers with [`esm.sh`][esmsh]:

```html
<script type="module">
import remarkParse from 'https://cdn.skypack.dev/remark-parse@10?min'
import remarkParse from 'https://esm.sh/remark-parse@10?bundle'
</script>
```

@@ -273,19 +273,23 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://www.hashicorp.com">HashiCorp</a><br><br>
<a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" colspan="2">
<a href="https://www.gitbook.com">GitBook</a><br><br>
<a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="10%" align="center">
<a href="https://www.coinbase.com">Coinbase</a><br><br>
<a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a>
@@ -299,8 +303,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boosthub.io">Boost Hub</a><br><br>
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
<a href="https://boostnote.io">Boost Note</a><br><br>
<a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
@@ -309,11 +313,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<td width="100%" align="center" colspan="8">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
@@ -369,7 +371,7 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!

[npm]: https://docs.npmjs.com/cli/install

[skypack]: https://www.skypack.dev
[esmsh]: https://esm.sh

[unified]: https://github.com/unifiedjs/unified

15 changes: 6 additions & 9 deletions packages/remark-parse/test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import test from 'tape'
import assert from 'node:assert/strict'
import test from 'node:test'
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', (t) => {
t.equal(
test('remarkParse', async (t) => {
assert.equal(
unified().use(remarkParse).parse('Alfred').children.length,
1,
'should accept a `string`'
)

t.test('extensions', (t) => {
await t.test('extensions', () => {
const tree = unified()
.data('micromarkExtensions', [gfm()])
.data('fromMarkdownExtensions', [gfmFromMarkdown()])
@@ -21,7 +22,7 @@ test('remarkParse', (t) => {

removePosition(tree, true)

t.deepEqual(
assert.deepEqual(
tree,
{
type: 'root',
@@ -61,9 +62,5 @@ test('remarkParse', (t) => {
},
'should work'
)

t.end()
})

t.end()
})
3 changes: 1 addition & 2 deletions packages/remark-parse/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"extends": "../../tsconfig.json",
"include": ["lib/**/*.js", "test.js"]
"extends": "../../tsconfig.json"
}
5 changes: 3 additions & 2 deletions packages/remark-stringify/index.d.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import type {Root} from 'mdast'
import type {Plugin} from 'unified'
import type {Options} from './lib/index.js'

declare const remarkStringify: Plugin<[Options?] | void[], Root, string>
declare const remarkStringify: Plugin<[(Options | undefined)?], Root, string>
export default remarkStringify
export type {Options}

export type {Options} from './lib/index.js'
4 changes: 1 addition & 3 deletions packages/remark-stringify/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import remarkStringify from './lib/index.js'

export default remarkStringify
export {default} from './lib/index.js'
5 changes: 4 additions & 1 deletion packages/remark-stringify/lib/index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,10 @@

import {toMarkdown} from 'mdast-util-to-markdown'

/** @type {import('unified').Plugin<[Options]|void[], Node, string>} */
/**
* @this {import('unified').Processor}
* @type {import('unified').Plugin<[Options?]|void[], Node, string>}
*/
export default function remarkStringify(options) {
/** @type {import('unified').CompilerFunction<Node, string>} */
const compiler = (tree) => {
5 changes: 2 additions & 3 deletions packages/remark-stringify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remark-stringify",
"version": "10.0.2",
"version": "10.0.3",
"description": "remark plugin to add support for serializing markdown",
"license": "MIT",
"keywords": [
@@ -46,8 +46,7 @@
"unified": "^10.0.0"
},
"scripts": {
"test": "node --conditions development test.js",
"build": "rimraf \"test.d.ts\" \"lib/**/*.d.ts\" && tsc && type-coverage"
"test": "node --conditions development test.js"
},
"xo": false,
"typeCoverage": {
30 changes: 16 additions & 14 deletions packages/remark-stringify/readme.md
Original file line number Diff line number Diff line change
@@ -69,17 +69,17 @@ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
npm install remark-stringify
```

In Deno with [Skypack][]:
In Deno with [`esm.sh`][esmsh]:

```js
import remarkStringify from 'https://cdn.skypack.dev/remark-stringify@10?dts'
import remarkStringify from 'https://esm.sh/remark-stringify@10'
```

In browsers with [Skypack][]:
In browsers with [`esm.sh`][esmsh]:

```html
<script type="module">
import remarkStringify from 'https://cdn.skypack.dev/remark-stringify@10?min'
import remarkStringify from 'https://esm.sh/remark-stringify@10?bundle'
</script>
```

@@ -303,19 +303,23 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://www.hashicorp.com">HashiCorp</a><br><br>
<a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" colspan="2">
<a href="https://www.gitbook.com">GitBook</a><br><br>
<a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="10%" align="center">
<a href="https://www.coinbase.com">Coinbase</a><br><br>
<a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a>
@@ -329,8 +333,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boosthub.io">Boost Hub</a><br><br>
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
<a href="https://boostnote.io">Boost Note</a><br><br>
<a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
@@ -339,11 +343,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<td width="100%" align="center" colspan="8">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
@@ -399,7 +401,7 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!

[npm]: https://docs.npmjs.com/cli/install

[skypack]: https://www.skypack.dev
[esmsh]: https://esm.sh

[unified]: https://github.com/unifiedjs/unified

194 changes: 90 additions & 104 deletions packages/remark-stringify/test.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/remark-stringify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"extends": "../../tsconfig.json",
"include": ["lib/**/*.js", "test.js"]
"extends": "../../tsconfig.json"
}
5 changes: 2 additions & 3 deletions packages/remark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remark",
"version": "14.0.2",
"version": "14.0.3",
"description": "unified processor with support for parsing markdown input and serializing markdown as output",
"license": "MIT",
"keywords": [
@@ -44,8 +44,7 @@
"unified": "^10.0.0"
},
"scripts": {
"test": "node --conditions development test.js",
"build": "rimraf \"*.d.ts\" && tsc && type-coverage"
"test": "node --conditions development test.js"
},
"xo": false,
"typeCoverage": {
30 changes: 16 additions & 14 deletions packages/remark/readme.md
Original file line number Diff line number Diff line change
@@ -65,17 +65,17 @@ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
npm install remark
```

In Deno with [Skypack][]:
In Deno with [`esm.sh`][esmsh]:

```js
import {remark} from 'https://cdn.skypack.dev/remark@14?dts'
import {remark} from 'https://esm.sh/remark@14'
```

In browsers with [Skypack][]:
In browsers with [`esm.sh`][esmsh]:

```html
<script type="module">
import {remark} from 'https://cdn.skypack.dev/remark@14?min'
import {remark} from 'https://esm.sh/remark@14?bundle'
</script>
```

@@ -258,19 +258,23 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://www.hashicorp.com">HashiCorp</a><br><br>
<a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" colspan="2">
<a href="https://www.gitbook.com">GitBook</a><br><br>
<a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="10%" align="center">
<a href="https://www.coinbase.com">Coinbase</a><br><br>
<a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a>
@@ -284,8 +288,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boosthub.io">Boost Hub</a><br><br>
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
<a href="https://boostnote.io">Boost Note</a><br><br>
<a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
@@ -294,11 +298,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<td width="100%" align="center" colspan="8">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
@@ -354,7 +356,7 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!

[npm]: https://docs.npmjs.com/cli/install

[skypack]: https://www.skypack.dev
[esmsh]: https://esm.sh

[unified]: https://github.com/unifiedjs/unified

11 changes: 5 additions & 6 deletions packages/remark/test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import test from 'tape'
import assert from 'node:assert/strict'
import test from 'node:test'
import {remark} from './index.js'

test('remark', (t) => {
t.equal(
test('remark', () => {
assert.equal(
remark().processSync('*foo*').toString(),
'*foo*\n',
'should parse and stringify a file'
)

t.equal(
assert.equal(
remark().data('settings', {closeAtx: true}).processSync('# foo').toString(),
'# foo #\n',
'should accept stringify options'
)

t.end()
})
2 changes: 1 addition & 1 deletion packages/remark/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["*.js"]
"references": [{"path": "../remark-parse/"}, {"path": "../remark-stringify/"}]
}
102 changes: 79 additions & 23 deletions readme.md
Original file line number Diff line number Diff line change
@@ -55,31 +55,63 @@ You can use the many existing plugins or you can make your own.

## What is this?

You can use plugins to turn markdown into HTML.
**In**:
With this project and a plugin, you can turn this markdown:

```markdown
# Hello, *Mercury*!
```

**Out**:
…into the following HTML:

```html
<h1>Hello, <em>Mercury</em>!</h1>
```

You can use plugins to change markdown.
**In**:
<details><summary>Show example code</summary>

```js
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkHtml from 'remark-html'

const file = await unified()
.use(remarkParse)
.use(remarkHtml)
.process('# Hello, *Mercury*!')

console.log(String(file)) // => '<h1>Hello, <em>Mercury</em>!</h1>'
```

</details>

With another plugin, you can turn this markdown:

```markdown
# Hi, Saturn!
```

**Plugin**:
…into the following markdown:

```markdown
## Hi, Saturn!
```

<details><summary>Show example code</summary>

```js
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {visit} from 'unist-util-visit'

const file = await unified()
.use(remarkParse)
.use(myRemarkPluginToIncreaseHeadings)
.use(remarkStringify)
.process('# Hi, Saturn!')

console.log(String(file)) // => '## Hi, Saturn!'

/** @type {import('unified').Plugin<[], import('mdast').Root>} */
function myRemarkPluginToIncreaseHeadings() {
return (tree) => {
@@ -92,11 +124,7 @@ function myRemarkPluginToIncreaseHeadings() {
}
```

**Out**:

```markdown
## Hi, Saturn!
```
</details>

You can use remark for many different things.
**[unified][]** is the core project that transforms content with ASTs.
@@ -138,7 +166,7 @@ Some popular examples are:
* [`remark-gfm`][remark-gfm]
— add support for GFM (GitHub flavored markdown)
* [`remark-lint`][remark-lint]
— inspect markdown and warns about inconsistencies
— inspect markdown and warn about inconsistencies
* [`remark-toc`][remark-toc]
— generate a table of contents
* [`remark-html`][remark-html]
@@ -349,13 +377,14 @@ extensions.

The syntax tree format used in remark is [mdast][].
It represents markdown constructs as JSON objects.
**In**:

This markdown:

```markdown
## Hello *Pluto*!
```

**Out**:
yields the following tree:

```js
{
@@ -375,6 +404,31 @@ The remark organization and the unified collective as a whole is fully typed
with [TypeScript][].
Types for mdast are available in [`@types/mdast`][types-mdast].

For TypeScript to work, it is particularly important to type your plugins
correctly.
We strongly recommend using the `Plugin` type from `unified` with its generics
and to use the node types for the syntax trees provided by `@types/mdast`.

```js
/**
* @typedef {import('mdast').Root} Root
*
* @typedef Options
* Configuration (optional).
* @property {boolean} [someField]
* Some option.
*/

// To type options and that the it works with `mdast`:
/** @type {import('unified').Plugin<[Options?], Root>} */
export function myRemarkPluginAcceptingOptions(options) {
// `options` is `Options?`.
return function (tree, file) {
// `tree` is `Root`.
}
}
```

## Compatibility

Projects maintained by the unified collective are compatible with all maintained
@@ -425,19 +479,23 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://www.hashicorp.com">HashiCorp</a><br><br>
<a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" colspan="2">
<a href="https://www.gitbook.com">GitBook</a><br><br>
<a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a>
</td>
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="20%" align="center" rowspan="2" 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>
</tr>
<tr valign="middle">
</tr>
<tr valign="middle">
<td width="10%" align="center">
<a href="https://www.coinbase.com">Coinbase</a><br><br>
<a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a>
@@ -451,8 +509,8 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://boosthub.io">Boost Hub</a><br><br>
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
<a href="https://boostnote.io">Boost Note</a><br><br>
<a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>
@@ -461,11 +519,9 @@ Support this effort and give back by sponsoring on [OpenCollective][collective]!
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
<tr valign="middle">
<td width="100%" align="center" colspan="10">
<td width="100%" align="center" colspan="8">
<br>
<a href="https://opencollective.com/unified"><strong>You?</strong></a>
<br><br>
34 changes: 12 additions & 22 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
import test from 'tape'
import assert from 'node:assert/strict'
import test from 'node:test'
import {removePosition} from 'unist-util-remove-position'
import {assert} from 'mdast-util-assert'
import {assert as mdastAssert} from 'mdast-util-assert'
import {remark} from '../packages/remark/index.js'
import {fixtures} from './fixtures/index.js'

test('fixtures', (t) => {
test('fixtures', async (t) => {
let index = -1

next()
while (++index < fixtures.length) {
const fixture = fixtures[index]

// Check the next fixture.
function next() {
const fixture = fixtures[++index]

if (!fixture) {
t.end()
return
}

setImmediate(next) // Queue next.

t.test(fixture.name, (t) => {
// eslint-disable-next-line no-await-in-loop
await t.test(fixture.name, () => {
const actualTree = remark().parse(fixture.input)

assert(actualTree)
mdastAssert(actualTree)

t.deepLooseEqual(
assert.deepEqual(
actualTree,
fixture.tree,
'should parse `' + fixture.name + '` correctly'
@@ -42,22 +34,20 @@ test('fixtures', (t) => {
removePosition(actualTree, true)
removePosition(reparsedTree, true)

t.deepEqual(
assert.deepEqual(
actualTree,
reparsedTree,
'should stringify `' + fixture.name + '`'
)
}

if (fixture.output === true) {
t.equal(
assert.equal(
fixture.input,
actualOutput,
'should stringify `' + fixture.name + '` exact'
)
}

t.end()
})
}
})
27 changes: 16 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"include": ["script/**/*.js", "test/**/*.js"],
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"module": "ES2020",
"moduleResolution": "node",
"resolveJsonModule": true,
"allowJs": true,
"customConditions": ["development"],
"checkJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"strict": true
}
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2020"],
"module": "node16",
"newLine": "lf",
"resolveJsonModule": true,
"strict": true,
"target": "es2020"
},
"exclude": ["**/coverage/", "**/node_modules/"],
"include": [
"**/*.js",
"packages/remark-parse/index.d.ts",
"packages/remark-stringify/index.d.ts"
]
}