Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
106 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.npmignore |
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,38 @@ | ||
# PIMD Allinc Plugin | ||
|
||
Load all PIMD plugins at once: | ||
|
||
- [Classes](https://github.com/hagenburger/pimd/tree/master/plugins/classes#readme) | ||
- [ID](https://github.com/hagenburger/pimd/tree/master/plugins/id#readme) | ||
- [Preview](https://github.com/hagenburger/pimd/tree/master/plugins/preview#readme) | ||
- [Highlight](https://github.com/hagenburger/pimd/tree/master/plugins/highlight#readme) | ||
- [Showmore](https://github.com/hagenburger/pimd/tree/master/plugins/showmore#readme) | ||
- [HTML injector](https://github.com/hagenburger/pimd/tree/master/plugins/html-injector#readme) | ||
|
||
## Usage | ||
|
||
```sh | ||
npm install --save-dev pimd @pimd/allinc-plugin | ||
``` | ||
|
||
```javascript +highlight=/allincPlugin/g,"require(\"@pimd/allinc-plugin\")",/(?<!\/)config/g | ||
const { Document } = require("pimd") | ||
const Config = require("pimd/lib/config") | ||
const allincPlugin = require("@pimd/allinc-plugin") | ||
const markdown = "# Example" | ||
|
||
const config = new Config() | ||
config.use(allincPlugin) | ||
|
||
const doc = new Document(markdown, config) | ||
console.log(doc.render()) | ||
``` | ||
|
||
--- | ||
|
||
## Copyright | ||
|
||
Copyright 2018++ [Nico Hagenburger](https://www.hagenburger.net). See | ||
[MIT-LICENSE](MIT-LICENSE) for details. Get in touch with | ||
[@hagenburger](https://twitter.com/hagenburger) on Twitter or | ||
[open an issue](https://github.com/hagenburger/pimd/issues/new). |
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,19 @@ | ||
const classesPlugin = require("@pimd/classes-plugin") | ||
const highlightPlugin = require("@pimd/highlight-plugin") | ||
const htmlInjectorPlugin = require("@pimd/html-injector-plugin") | ||
const idPlugin = require("@pimd/id-plugin") | ||
const previewPlugin = require("@pimd/preview-plugin") | ||
const prismPlugin = require("@pimd/prism-plugin") | ||
const showmorePlugin = require("@pimd/showmore-plugin") | ||
|
||
module.exports = function(config) { | ||
// Order does matter: | ||
config.use(htmlInjectorPlugin) | ||
// Order does not matter: | ||
config.use(classesPlugin) | ||
config.use(highlightPlugin) | ||
config.use(idPlugin) | ||
config.use(previewPlugin) | ||
config.use(prismPlugin) | ||
config.use(showmorePlugin) | ||
} |
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,25 @@ | ||
{ | ||
"name": "@pimd/allinc-plugin", | ||
"version": "0.0.0", | ||
"description": "Loads all plugins at once", | ||
"main": "index.js", | ||
"author": "Nico Hagenburger <nico@hagenburger.net> (https://twitter.com/hagenburger)", | ||
"keywords": [ | ||
"markdown", | ||
"pimd-plugin" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@pimd/classes-plugin": "0.1.5", | ||
"@pimd/highlight-plugin": "0.1.3", | ||
"@pimd/html-injector-plugin": "0.1.1", | ||
"@pimd/id-plugin": "0.1.4", | ||
"@pimd/preview-plugin": "0.1.5", | ||
"@pimd/prism-plugin": "0.1.1", | ||
"@pimd/showmore-plugin": "0.1.1", | ||
"pimd": "^0.5.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const { Document } = require("../..") | ||
const plugin = require(".") | ||
|
||
describe("Allinc", () => { | ||
it("should have all plugins loaded", () => { | ||
const input = unindent` | ||
# Test <?: .my-class #my-id ?> | ||
~~~html +preview +highlight="x" +showmore=1 | ||
<p>x</p> | ||
~~~ | ||
` | ||
const doc = new Document(input) | ||
doc.config.use(plugin) | ||
const html = doc.render() | ||
expect(html).to.have.selector("h1.my-class") | ||
expect(html).to.have.selector("h1#my-id") | ||
expect(html).to.have.selector(".pimd-preview p") | ||
expect(html).to.have.selector(".pimd-highlight") | ||
expect(html).to.have.selector(".pimd-example div[style='display: none']") | ||
expect(html).to.have.selector("code span.token.punctuation") | ||
}) | ||
}) |