A Vue.js Component for editing and previewing markdown.
npm install vuetify-markdown-editor


A Vue.js Component for editing and previewing markdown using Vuetify.js and markdown-it.
```
npm install vuetify-markdown-editor
Since this component is based on Vuetify,
it is required to install and configure Vuetify.
For installing Vuetify, please visit
- TypeScript support
- Solo and inline mode
- Editor-only and Editor-Preview mode
- Code highlighting
- Emoji picking
- Math formula (See markdown-it-texmath)
- Image uploading and previewing (to use uploaded image in markdown, use the filename as the link)
- Mermaid diagram rendering (use code block with language mermaid)
* [x] Fix SSR
* [x] Allow to change sets of emoji
* [x] Add typescript support
* [x] Add copy icon
* [x] Add viewer mode
* [ ] Fix large image
* [ ] Add self-hosted emoji images
* [ ] Add emoji rendering in rendered text
* [ ] Add more WYSIWYG functions
* [ ] Add plantuml support
This package can be used in Node.js module:
`html
ref="editor"
hint="Hint"
:outline="false"
:render-config="renderConfig"
v-model="text"
/>
`
To show the rendered html only, use viewer mode.
To use the markdown-it renderer directly,
use createRenderer to create it.
* Editor: a vue component to edit markdown
* createRenderer: a function to create a markdown-it render
| Prop | Default | Description |
| ------------- | --------------------------------------- | ---------------------------------------------------------------- |
| value | '' | String that binds to the textarea |'preview'
| mode | | Possible value 'editor', 'preview' or 'viewer'. When set to 'editor' or 'viewer', only the editor or viewer is displayed, while 'preview' mode displays both. |undefined
| renderConfig | | Override default configurations |false
| outline | | The border will be outlined instead of card style |undefined
| color | | The outline and icon's color |false
| nativeEmoji | | Use native emoji instead of pictures |true
| emoji | | Enable emoji input |"apple"
| emojiSet | | Supported emoji sets: 'apple', 'google', 'twitter', 'facebook' |true
| image | | Enable image upload |'/'
| fileTarget | | Image upload target uri |file => file.type.startsWith('image')
| fileFilter | | Allow only specific files. Return true to allow, false to reject |'/'
| baseUrl | | The baseUrl for uploaded images. Must end with a slash (mainly used in viewer mode) |
Other props that are not listed in the above table will be directly passed to v-textarea,v-textarea
which enables you to set the native props in .
`js`
{
// markdown-it-texmath config
texmath: undefined,
// markdown-it-highlightjs config
hightlightjs: undefined,
// markdown-it-code-copy config
codeCopy: {
buttonClass: 'v-icon theme--dark'
},
// The native mermaid config
mermaid: undefined,
// Markdown-it config
markdownIt: undefined
}
| Method | Description |
| -------- | ------------------------------------------- |
| upload() | Start or resume uploading all files in list |
| pause() | Pause uploading |
| resume() | Resume uploading |
| focus() | Focus on the editor |
| Property | Description |
| -------- | -------------------------------------------------------------------------------------- |
| files | Get all files in list in FlowFile format |
Clone this repository,
and then run:
``
npm install
npm run serve
Then open
Solo mode:
!Solo
Dark mode: this.$vuetify.theme.dark = true;
!Dark
Outline mode:
- mermaid
- KaTeX
- markdown-it
- markdown-it-highlightjs
- markdown-it-texmath
- markdown-it-code-copy
- markdown-it-mermaid-plugin
- Vuetify
- emoji-mart-vue
- v-click-outside
- Flow.js
MIT License