-
Notifications
You must be signed in to change notification settings - Fork 31
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
10 changed files
with
90 additions
and
1 deletion.
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
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 @@ | ||
src/*.js | ||
src/*.d.ts |
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,37 @@ | ||
# @bytemd/plugin-footnotes | ||
|
||
[![npm](https://img.shields.io/npm/v/@bytemd/plugin-footnotes.svg)](https://npm.im/@bytemd/plugin-footnotes) | ||
|
||
[bytemd](https://github.com/bytedance/bytemd) plugin to support footnotes | ||
|
||
## Usage | ||
|
||
```js | ||
import { Editor } from 'bytemd'; | ||
import footnotes from '@bytemd/plugin-footnotes'; | ||
|
||
new Editor({ | ||
target: document.body, | ||
props: { | ||
plugins: [ | ||
footnotes(), | ||
// ... other plugins | ||
], | ||
}, | ||
}); | ||
``` | ||
|
||
## Example | ||
|
||
```md | ||
Here is a footnote reference,[^1] | ||
|
||
another,[^longnote], | ||
|
||
[^1]: Here is the footnote. | ||
[^longnote]: Here’s one with multiple blocks. | ||
``` | ||
|
||
## License | ||
|
||
MIT |
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 @@ | ||
support footnotes |
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,8 @@ | ||
```md | ||
Here is a footnote reference,[^1] | ||
|
||
another,[^longnote], | ||
|
||
[^1]: Here is the footnote. | ||
[^longnote]: Here’s one with multiple 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@bytemd/plugin-footnotes", | ||
"version": "0.0.2", | ||
"description": "@bytemd/plugin-footnotes", | ||
"author": "Rongjian Zhang <pd4d10@gmail.com>", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"unpkg": "dist/index.min.js", | ||
"types": "src/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src/*.d.ts" | ||
], | ||
"dependencies": { | ||
"remark-footnotes": "^1.0.0" | ||
}, | ||
"peerDependencies": { | ||
"bytemd": "*" | ||
} | ||
} |
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,14 @@ | ||
import { BytemdPlugin } from 'bytemd'; | ||
import remarkFootnotes from 'remark-footnotes'; | ||
|
||
export default function footnotes(): BytemdPlugin { | ||
return { | ||
remarkTransformer: (u) => u.use(remarkFootnotes), | ||
markdownSanitizeSchema: { | ||
attributes: { | ||
div: ['className'], | ||
a: ['className'], | ||
}, | ||
}, | ||
}; | ||
} |
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