mirror of
https://github.com/zhigang1992/mdx-util.git
synced 2026-01-12 17:32:23 +08:00
remove some surprising typography features
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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": {
|
||||
|
||||
17
packages/mdx-loader/typography.js
Normal file
17
packages/mdx-loader/typography.js
Normal file
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user