# editorjs-md-parser

> Import from markdown and export editorjs data to markdown

Latest version **0.0.3** (published 2023-04-01) · 0 weekly downloads

## Install

```sh
npm install editorjs-md-parser
pnpm add editorjs-md-parser
yarn add editorjs-md-parser
bun add editorjs-md-parser
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-04-01 |
| First published | 2023-03-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 245.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Paolo William Carrara |
| Maintainers | carrara88 |

## Links

- npm: https://www.npmjs.com/package/editorjs-md-parser
- npm.io page: https://npm.io/package/editorjs-md-parser

## Dependencies (5)

- [remark](https://npm.io/package/remark.md) ^13.0.0
- [require](https://npm.io/package/require.md) ^2.4.20
- [css-loader](https://npm.io/package/css-loader.md) ^5.0.0
- [remark-parse](https://npm.io/package/remark-parse.md) ^9.0.0
- [style-loader](https://npm.io/package/style-loader.md) ^2.0.0

## Recent versions

- 0.0.3 (latest) — 2023-04-01
- 0.0.2 — 2023-04-01
- 0.0.1 — 2023-03-31

## README

# editorjs-md-parser
Editor.js markdown parser with dinamically import/export functions.
Forked from https://github.com/stejul/editorjs-markdown-parser, and converted from yarn into an npm package.

##### Additional capabilities and changes:
- [x] Refactored functions to enable parsering without upload/download files.
- [x] Textarea input for markdown insert from string
- [x] Paste support for .md and .txt files (with drag and drop)
- [x] Recoursive function for markdown to blocks
- [x] Config options import/export with callbacks
- [\] Support inline attributes for strong, emphasis, links (work in progress)


## Usage

- Load up the bundled file (dist/bundle.js) in you document or import from npm package:

```bash
// from npm package installed with `npm i editorjs-md-parser`
import MDParser from 'editorjs-md-parser';
import MDImporter from 'editorjs-md-parser';
```

- Add the file Importer/Exporter to the EditorJS tools:

```js
const editor = new EditorJS({
    autofocuse: true,
    tools: {
      markdownParser: {
          class: MDParser,
          config: {
              filename: 'test',
              timestamp: true,
              callback: (blocksData) => { console.log("Callback MDParser", blocksData) }
          },
      },

      markdownImporter: {
          class: MDImporter,
          config: {
              append: true,
              extensions: ['md', 'txt'],
              callback: (blocksData) => { console.log("Callback MDImporter", blocksData) }
          },
      }
    },
};
```

***The Plugin can now be used in the Editor-Toolbar with file upload/download***

Also, to parse a string dinamically without file upload/download, you can use the **new functions**:

```js
//parse markdown string input and load into editor
MDImporter.parseFromMarkdown(content:string):void
//parse editor content json and return a markdown string output
MDParser.parseToMarkdown():string
```

## Developing

To install npm packages and build, from this project root folder, run:

```
npm install
npm run build
```

A fresh new /dev/bundle.js file will be created.

## Contributing

Same from original repo, 
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**.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/NewFeature`)
3. Commit your Changes (`git commit -m 'Add some NewFeature'`)
4. Push to the Branch (`git push origin feature/NewFeature`)
5. Open a Pull Request

## Acknowledgements

Thanks to https://github.com/stejul for his original great parser script, this is just a little change!

---
_Source: https://npm.io/package/editorjs-md-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
