-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into daniel/3164
- Loading branch information
Showing
22 changed files
with
296 additions
and
20 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
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
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,7 +1,7 @@ | ||
{ | ||
"name": "gatsby-remark-autolink-headers", | ||
"description": "Gatsby plugin to autolink headers in markdown processed by Remark", | ||
"version": "1.4.10", | ||
"version": "1.4.11", | ||
"author": "Kyle Mathews <[email protected]>", | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
|
4 changes: 2 additions & 2 deletions
4
packages/gatsby-remark-autolink-headers/src/gatsby-browser.js
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
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
*.un~ | ||
yarn.lock | ||
src | ||
flow-typed | ||
coverage | ||
decls | ||
examples |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# gatsby-remark-custom-blocks | ||
|
||
Adds custom blocks to `MarkdownRemark` using [remark-custom-blocks](https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-custom-blocks). | ||
|
||
## Install | ||
|
||
`npm install --save gatsby-remark-custom-blocks` | ||
|
||
## How to use | ||
|
||
```javascript | ||
// In your gatsby-config.js | ||
plugins: [ | ||
{ | ||
resolve: `gatsby-transformer-remark`, | ||
options: { | ||
plugins: [ | ||
{ | ||
resolve: "gatsby-remark-custom-blocks", | ||
options: { | ||
blocks: { | ||
danger: "custom-block-danger", | ||
info: "custom-block-info", | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "gatsby-remark-custom-blocks", | ||
"version": "1.0.1", | ||
"description": "Gatsby remark plugin for adding custom blocks in markdown", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "yarn prebuild && babel --out-dir dist --ignore __tests__ src", | ||
"prepublish": "yarn build" | ||
}, | ||
"repository": "https://github.com/AlahmadiQ8/gatsby-remark-custom-blocks", | ||
"keywords": [ | ||
"gatsby", | ||
"gatsby-plugin", | ||
"markdown", | ||
"remark" | ||
], | ||
"author": "Mohammad Asad Mohammad <[email protected]>", | ||
"license": "MIT", | ||
"private": false, | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"rimraf": "^2.6.2", | ||
"unist-util-find": "^1.0.1" | ||
}, | ||
"dependencies": { | ||
"remark-custom-blocks": "^1.0.6" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/gatsby-remark-custom-blocks/src/__tests__/index.js
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const Remark = require(`remark`) | ||
const find = require(`unist-util-find`) | ||
const plugin = require(`../index`) | ||
|
||
describe(`gatsby-remark-custom-blocks`, () => { | ||
let remark | ||
|
||
beforeEach(() => { | ||
remark = new Remark() | ||
}) | ||
|
||
it(`errors if missing required plugin options`, () => { | ||
expect(plugin.setParserPlugins).toThrow(`missing required "blocks" option`) | ||
}) | ||
|
||
it(`creates nodes of blocks given in options`, () => { | ||
const parserPlugins = plugin.setParserPlugins({ | ||
blocks: { someType: `test`, anotherType: `another` }, | ||
}) | ||
const [parser, options] = parserPlugins[0] | ||
remark.use(parser, options) | ||
const markdownAST = remark.parse(` | ||
[[someType]] | ||
| content | ||
[[anotherType]] | ||
| content`) | ||
expect(find(markdownAST, { type: `someTypeCustomBlock` })).toBeTruthy() | ||
expect(find(markdownAST, { type: `anotherTypeCustomBlock` })).toBeTruthy() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const isNil = require(`lodash/isNil`) | ||
const has = require(`lodash/has`) | ||
const remarkCustomBlocks = require(`remark-custom-blocks`) | ||
|
||
module.exports.setParserPlugins = options => { | ||
if (isNil(options) || !has(options, `blocks`)) { | ||
throw Error(`missing required "blocks" option`) | ||
} | ||
return [[remarkCustomBlocks, options.blocks]] | ||
} |
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,7 +1,7 @@ | ||
{ | ||
"name": "gatsby-transformer-remark", | ||
"description": "Gatsby transformer plugin for Markdown using the Remark library and ecosystem", | ||
"version": "1.7.25", | ||
"version": "1.7.26", | ||
"author": "Kyle Mathews <[email protected]>", | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const stripPrefix = require(`../strip-prefix`).default | ||
|
||
describe(`strip-prefix`, () => { | ||
it(`strips a prefix`, () => { | ||
expect(stripPrefix(`/foo/bar/`, `/foo`)).toBe(`/bar/`) | ||
}) | ||
|
||
it(`strips first instance only`, () => { | ||
expect(stripPrefix(`/foo/foo/bar/`, `/foo`)).toBe(`/foo/bar/`) | ||
}) | ||
|
||
it(`ignores prefix appearing elsewhere in the string`, () => { | ||
expect(stripPrefix(`/foo/bar/`, `bar`)).toBe(`/foo/bar/`) | ||
}) | ||
|
||
it(`ignores a non-existent prefix`, () => { | ||
expect(stripPrefix(`/bar`, `/foo`)).toBe(`/bar`) | ||
}) | ||
|
||
it(`returns input str if no prefix is provided`, () => { | ||
expect(stripPrefix(`/bar`)).toBe(`/bar`) | ||
}) | ||
}) |
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
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
Oops, something went wrong.