From 0daf708fcae555d0a338e73005a51eac2baef3ae Mon Sep 17 00:00:00 2001 From: James K Nelson Date: Sun, 16 Dec 2018 13:19:30 +0900 Subject: [PATCH] remove some surprising typography features --- packages/mdx-loader/README.md | 2 +- packages/mdx-loader/index.js | 4 ++-- packages/mdx-loader/package.json | 10 ++++++++-- packages/mdx-loader/typography.js | 17 +++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 packages/mdx-loader/typography.js diff --git a/packages/mdx-loader/README.md b/packages/mdx-loader/README.md index 7a018e2..c7e90d5 100644 --- a/packages/mdx-loader/README.md +++ b/packages/mdx-loader/README.md @@ -13,7 +13,7 @@ A webpack loader to convert Markdown files into React components. * Code blocks have markup for syntax highlighting via [prismjs](https://prismjs.com/) and [rehype-prism](https://github.com/mapbox/rehype-prism). *Note: you'll still need to import the prism stylesheet yourself.* * Front matter is exported on a `frontMatter` object via [gray-matter](https://github.com/jonschlinkert/gray-matter). * A table of contents object is exported on the `tableOfContents` object via [mdx-table-of-contents](./packages/mdx-table-of-contents). -* Pretty typograhy via [remark-textr](https://github.com/remarkjs/remark-textr) and [typograhic-base](https://github.com/iamstarkov/typographic-base). +* Pretty typograhy via [remark-textr](https://github.com/remarkjs/remark-textr). ## Usage diff --git a/packages/mdx-loader/index.js b/packages/mdx-loader/index.js index 2b91f4b..c2fac5a 100644 --- a/packages/mdx-loader/index.js +++ b/packages/mdx-loader/index.js @@ -7,7 +7,7 @@ const mdx = require('@mdx-js/mdx') const mdxTableOfContents = require('mdx-table-of-contents') const mdxExportJSONByDefault = require('mdx-constant') const grayMatter = require('gray-matter') -const typographicBase = require('typographic-base') +const typography = require('./typography') const rehypePrism = require('./rehype-prism') module.exports = async function(source) { @@ -20,7 +20,7 @@ module.exports = async function(source) { slug, images, emoji, - [textr, { plugins: [typographicBase] }] + [textr, { plugins: [typography] }] ], hastPlugins: [ rehypePrism, diff --git a/packages/mdx-loader/package.json b/packages/mdx-loader/package.json index 92b5804..483aae3 100644 --- a/packages/mdx-loader/package.json +++ b/packages/mdx-loader/package.json @@ -1,6 +1,6 @@ { "name": "mdx-loader", - "version": "2.0.2", + "version": "2.1.0", "main": "index.js", "keywords": [ "mdx", @@ -25,7 +25,13 @@ "remark-images": "^0.8.1", "remark-slug": "^5.1.0", "remark-textr": "^3.0.2", - "typographic-base": "^1.0.4", + "textr": "^0.3.0", + "typographic-apostrophes": "^1.1.1", + "typographic-apostrophes-for-possessive-plurals": "^1.0.5", + "typographic-ellipses": "^1.0.11", + "typographic-em-dashes": "^1.0.2", + "typographic-en-dashes": "^1.0.1", + "typographic-quotes": "^1.2.1", "unist-util-visit": "^1.4.0" }, "repository": { diff --git a/packages/mdx-loader/typography.js b/packages/mdx-loader/typography.js new file mode 100644 index 0000000..aefcb20 --- /dev/null +++ b/packages/mdx-loader/typography.js @@ -0,0 +1,17 @@ +import textr from 'textr'; +import apostrophes from 'typographic-apostrophes'; +import quotes from 'typographic-quotes'; +import apostrophesForPlurals from 'typographic-apostrophes-for-possessive-plurals'; +import ellipses from 'typographic-ellipses'; +import emDashes from 'typographic-em-dashes'; +import enDashes from 'typographic-en-dashes'; + +export default textr() + .use( + apostrophes, + quotes, + apostrophesForPlurals, + ellipses, + emDashes, + enDashes + );