Skip to content
This repository was archived by the owner on Nov 13, 2021. It is now read-only.

Commit bc67117

Browse files
committed
added the finishing touches
1 parent e81320d commit bc67117

File tree

7 files changed

+155
-1759
lines changed

7 files changed

+155
-1759
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Stefan Mikic
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,86 @@
1-
Markdown Parser for Editor.js
1+
<h3 align="center">EditorJS Markdown Importer/Exporter</h3>
22

3-
* export to markdown
4-
* load from markdown
5-
* save MDX information as well
3+
<p align="center">
4+
A plugin which allows the user to export the EditorJS data to Markdown and import it from Markdown.
5+
</p>
6+
7+
8+
## Table of Contents
9+
10+
* [About the Project](#about-the-project)
11+
* [Built With](#built-with)
12+
* [Getting Started](#getting-started)
13+
* [Prerequisites](#prerequisites)
14+
* [Installation](#installation)
15+
* [Usage](#usage)
16+
* [Contributing](#contributing)
17+
* [License](#license)
18+
* [Acknowledgements](#acknowledgements)
19+
20+
21+
22+
## About The Project
23+
24+
I intend to use the editor which should be exported/imported from Markdown.
25+
26+
### Built With
27+
28+
* [Remark](https://remark.js.org/)
29+
30+
31+
## Getting Started
32+
33+
To get a local copy up and running follow these simple steps.
34+
35+
### Prerequisites
36+
37+
- yarn
38+
39+
### Installation
40+
41+
1. Clone the repo
42+
```sh
43+
git clone https://github.com/stejul/editorjs-markdown-parser
44+
```
45+
2. Install packages
46+
```sh
47+
yarn
48+
```
49+
50+
## Usage
51+
52+
- Load up the bundled file (`dist/bundle.js`) in you document.
53+
- Add the Importer/Exporter to the EditorJS tools.
54+
55+
```js
56+
const editor = new EditorJS({
57+
autofocuse: true,
58+
tools: {
59+
markdownParser: MDParser,
60+
61+
markdownImporter: MDImporter,
62+
},
63+
};
64+
```
65+
66+
***The Plugin can now be used in the Editor-Toolbar***
67+
68+
69+
## Contributing
70+
71+
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
72+
73+
1. Fork the Project
74+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
75+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
76+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
77+
5. Open a Pull Request
78+
79+
80+
## License
81+
82+
Distributed under the MIT License. See `LICENSE` for more information.
83+
84+
## Acknowledgements
85+
86+
* [Lukas Gabsi](https://github.com/stejul/editorjs-markdown-parser) - Helped me with his JS expertise

dist/bundle.js

Lines changed: 21 additions & 1738 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<head>
44
<link href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet">
5-
<link href="assets/demo.css" rel="stylesheet">
65
<script src="dist/bundle.js" type="module"></script>
76
<script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header -->
87
<script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script><!-- Image -->
@@ -12,13 +11,12 @@
1211
<script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script><!-- Quote -->
1312
<script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script><!-- Code -->
1413
<script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script><!-- Embed -->
15-
<script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script><!-- Table -->
1614
<script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script><!-- Link -->
1715
<script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script><!-- Warning -->
1816

1917
<script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script><!-- Marker -->
2018
<script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script><!-- Inline Code -->
21-
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
19+
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script><!-- Inline Code -->
2220
<script src="dist/bundle.js"></script>
2321
<style>
2422
#title {
@@ -44,7 +42,7 @@
4442
</head>
4543

4644
<body>
47-
<h2 id="title">Editor.js - Github Gist Plugin</h2>
45+
<h2 id="title">Editor.js - Markdown Importer/Exporter Plugin</h2>
4846
<div id="editorjs"></div>
4947
<div id="output-wrapper">
5048
<button id="save-button" class="cdx-button">Save</button>
@@ -109,17 +107,10 @@ <h2 id="title">Editor.js - Github Gist Plugin</h2>
109107
linkTool: LinkTool,
110108

111109
embed: Embed,
110+
111+
markdownParser: MDParser,
112112

113-
parser: MarkdownParser,
114-
importer: MarkdownImporter,
115-
116-
table: {
117-
class: Table,
118-
inlineToolbar: true,
119-
shortcut: 'CMD+ALT+T'
120-
},
121-
122-
113+
mardkownImporter: MDImporter,
123114
},
124115
});
125116

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
import MarkdownParser from './MarkdownParser';
22
import MarkdownImporter from './MarkdownImporter';
3+
4+
export const MDParser = MarkdownParser;
5+
6+
export const MDImporter = MarkdownImporter;

webpack.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ const path = require('path');
33
module.exports = {
44
entry: {
55
bundle: [
6-
path.resolve(__dirname, 'src/MarkdownParser.js'),
7-
path.resolve(__dirname, 'src/MarkdownImporter.js'),
6+
path.resolve(__dirname, 'src/index.js'),
87
],
98
},
109
module: {
@@ -32,7 +31,6 @@ module.exports = {
3231
path: path.resolve(__dirname, 'dist'),
3332
filename: '[name].js',
3433
libraryTarget: 'umd',
35-
libraryExport: 'default',
3634
},
3735
devServer: {
3836
index: 'index.html',

yarn.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,14 @@
824824
lodash "^4.17.19"
825825
to-fast-properties "^2.0.0"
826826

827+
"@editorjs/editorjs@^2.19.0":
828+
version "2.19.0"
829+
resolved "https://registry.yarnpkg.com/@editorjs/editorjs/-/editorjs-2.19.0.tgz#ac98f7b1e627c89b51c4430f6aa325e873ade7fc"
830+
integrity sha512-8PUVaBZx69IrG8dNrE+FZbHSiRTR8ql8L/cmEi1mOdEdTqnOLq5Wv9dgemK00mBWEgNoavMAjtGQpItGknAa8A==
831+
dependencies:
832+
codex-notifier "^1.1.2"
833+
codex-tooltip "^1.0.1"
834+
827835
"@eslint/eslintrc@^0.2.1":
828836
version "0.2.1"
829837
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.1.tgz#f72069c330461a06684d119384435e12a5d76e3c"
@@ -1700,6 +1708,16 @@ cliui@^5.0.0:
17001708
strip-ansi "^5.2.0"
17011709
wrap-ansi "^5.1.0"
17021710

1711+
codex-notifier@^1.1.2:
1712+
version "1.1.2"
1713+
resolved "https://registry.yarnpkg.com/codex-notifier/-/codex-notifier-1.1.2.tgz#a733079185f4c927fa296f1d71eb8753fe080895"
1714+
integrity sha512-DCp6xe/LGueJ1N5sXEwcBc3r3PyVkEEDNWCVigfvywAkeXcZMk9K41a31tkEFBW0Ptlwji6/JlAb49E3Yrxbtg==
1715+
1716+
codex-tooltip@^1.0.1:
1717+
version "1.0.1"
1718+
resolved "https://registry.yarnpkg.com/codex-tooltip/-/codex-tooltip-1.0.1.tgz#f6e4f39d81507f9c455b667f1287746d14ee8056"
1719+
integrity sha512-1xLb1NZbxguNtf02xBRhDphq/EXvMMeEbY0ievjQTHqf8UjXsD41evGk9rqcbjpl+JOjNgtwnp1OaU/X/h6fhQ==
1720+
17031721
collection-visit@^1.0.0:
17041722
version "1.0.0"
17051723
resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"

0 commit comments

Comments
 (0)