get-alex / alex

Catch insensitive, inconsiderate writing
https://alexjs.com
MIT License
4.81k stars 208 forks source link

Add MDX support #270

Closed darthtrevino closed 4 years ago

darthtrevino commented 4 years ago

Support MDX Format

MDX is a language for component-based markdown (https://mdxjs.com/). It would be fantastic if the tool could detect and lint MDX files by default

wooorm commented 4 years ago

Hey that’s a great idea, I never thought of that (“disclaimer:” I help maintain MDX).

Implementation on the API would look very much like the Markdown version, with one added line:

+var mdx = require('remark-mdx')

 // ...

  return core(
    value,
    unified()
      .use(markdown)
      .use(frontmatter, ['yaml', 'toml'])
+     .use(mdx)
      .use(remark2retext, makeText(config))
      .use(filter, {allow: allow})
  )