-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,81 @@ | ||
# gridsome-remark-katex | ||
Gridsome remark support for math equations using remark-math and katex. | ||
|
||
## Install | ||
- `yarn add gridsome-remark-katex` | ||
- `npm install gridsome-remark-katex` | ||
|
||
## Usage | ||
|
||
In your `main.js` file, import the CSS for Katex: | ||
|
||
```js | ||
import 'katex/dist/katex.min.css' | ||
|
||
export default function (Vue) { | ||
// ... | ||
} | ||
``` | ||
|
||
In `gridsome.config.js`, add support for math equations to a single markdown source: | ||
|
||
```js | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
use: '@gridsome/source-filesystem', | ||
options: { | ||
path: 'blog/**/*.md', | ||
route: '/blog/:year/:month/:day/:slug', | ||
remark: { | ||
plugins: [ | ||
'gridsome-remark-katex' | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Or add support for math equations to all markdown sources: | ||
|
||
```js | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
use: '@gridsome/source-filesystem', | ||
options: {} | ||
} | ||
], | ||
|
||
transformers: { | ||
remark: { | ||
plugins: [ | ||
'gridsome-remark-katex' | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
You can also pass any option that is available in katex: | ||
|
||
```js | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
use: '@gridsome/source-filesystem', | ||
options: {} | ||
} | ||
], | ||
|
||
transformers: { | ||
remark: { | ||
plugins: [ | ||
['gridsome-remark-katex', { minRuleThickness: 0.1 }] | ||
] | ||
} | ||
} | ||
} | ||
``` |