├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── other.md └── workflows │ ├── deploy.yml │ └── test.yml ├── .gitignore ├── LICENSE ├── README.md ├── __tests__ ├── Markdown.spec.js ├── __snapshots__ │ ├── parse.spec.js.snap │ └── serialize.spec.js.snap ├── clipboard.spec.js ├── parse.spec.js ├── serialize.spec.js ├── tight-lists.spec.js ├── util.spec.js └── utils │ ├── dom.js │ ├── editor.js │ ├── index.js │ ├── parse.js │ ├── serialize.js │ ├── setup-dom.js │ └── setup.js ├── babel.config.js ├── docs └── migration.md ├── example ├── .gitignore ├── index.html ├── package.json ├── src │ ├── App.vue │ ├── app.scss │ ├── components │ │ ├── Editor.vue │ │ └── MenuBar.vue │ ├── data │ │ ├── content.md │ │ └── large-content.js │ ├── extensions │ │ ├── container.js │ │ └── highlight.js │ └── main.js └── vite.config.js ├── index.d.ts ├── package-lock.json ├── package.json ├── src ├── Markdown.js ├── extensions │ ├── index.js │ ├── marks │ │ ├── bold.js │ │ ├── code.js │ │ ├── html.js │ │ ├── italic.js │ │ ├── link.js │ │ └── strike.js │ ├── nodes │ │ ├── blockquote.js │ │ ├── bullet-list.js │ │ ├── code-block.js │ │ ├── hard-break.js │ │ ├── heading.js │ │ ├── horizontal-rule.js │ │ ├── html.js │ │ ├── image.js │ │ ├── list-item.js │ │ ├── ordered-list.js │ │ ├── paragraph.js │ │ ├── table.js │ │ ├── task-item.js │ │ ├── task-list.js │ │ └── text.js │ └── tiptap │ │ ├── clipboard.js │ │ └── tight-lists.js ├── index.js ├── parse │ └── MarkdownParser.js ├── serialize │ ├── MarkdownSerializer.js │ └── state.js └── util │ ├── dom.js │ ├── extensions.js │ ├── markdown.js │ └── prosemirror.js └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | root = true 3 | 4 | [*] 5 | end_of_line = lf 6 | charset = utf-8 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | indent_style = space 10 | indent_size = 4 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [*.{json,scss}] 16 | indent_size = 2 17 | 18 | [*.yml] 19 | indent_size = 2 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Prefer a discussion 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Please create a [discussion](https://github.com/aguingand/tiptap-markdown/discussions) for general question or troubleshooting.** 11 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy static content to Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ['main'] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow one concurrent deployment 19 | concurrency: 20 | group: 'pages' 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | # Single deploy job since we're just deploying 25 | deploy: 26 | environment: 27 | name: github-pages 28 | url: ${{ steps.deployment.outputs.page_url }} 29 | runs-on: ubuntu-latest 30 | steps: 31 | - name: Checkout 32 | uses: actions/checkout@v3 33 | - name: Set up Node 34 | uses: actions/setup-node@v3 35 | with: 36 | node-version: 18 37 | cache: 'npm' 38 | - name: Install dependencies 39 | run: npm install 40 | - name: Build 41 | run: npm run build:example 42 | - name: Setup Pages 43 | uses: actions/configure-pages@v3 44 | - name: Upload artifact 45 | uses: actions/upload-pages-artifact@v1 46 | with: 47 | # Upload dist repository 48 | path: './example/dist' 49 | - name: Deploy to GitHub Pages 50 | id: deployment 51 | uses: actions/deploy-pages@v1 52 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | branches: ['main'] 5 | pull_request: 6 | branches: ['main'] 7 | jobs: 8 | test: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | - name: Setup Node 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: 18 17 | cache: 'npm' 18 | - name: Install dependencies 19 | run: npm install 20 | - name: Test 21 | run: npm run test 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | 4 | .DS_Store 5 | *.local 6 | .idea 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021, Antoine Guingand 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!WARNING] 2 | As Tiptap have now a solution for markdown (paid [Conversion extension](https://next.tiptap.dev/docs/conversion/import-export/markdown/editor-extensions) and more markdown handling [announced for v3](https://next.tiptap.dev/docs/resources/whats-new#whats-next-in-tiptap-3x)). I don't plan to release [v1](https://github.com/aguingand/tiptap-markdown/pull/67) nor addressing current issues / PR. Feel free to fork the project if you need. 3 | 4 | # Tiptap markdown 5 | 6 | The markdown extension for [Tiptap editor](https://www.tiptap.dev/). 7 | 8 | ## Installation 9 | 10 | ```bash 11 | npm install tiptap-markdown 12 | ``` 13 | 14 | ### Requirements 15 | Supports all frameworks handled by Tiptap (Vue 2, Vue 3, React, [see full list](https://www.tiptap.dev/installation#integration-guides)...) 16 | 17 | ## Usage 18 | Basic example: 19 | 20 | ```js 21 | import { Editor } from '@tiptap/core'; 22 | import StarterKit from '@tiptap/starter-kit'; 23 | import { Markdown } from 'tiptap-markdown'; 24 | 25 | const editor = new Editor({ 26 | content: "# Title", 27 | extensions: [ 28 | StarterKit, 29 | Markdown, 30 | ], 31 | }); 32 | const markdownOutput = editor.storage.markdown.getMarkdown(); 33 | ``` 34 | 35 | ## API 36 | 37 | ### Options 38 | Default options: 39 | ```js 40 | Markdown.configure({ 41 | html: true, // Allow HTML input/output 42 | tightLists: true, // No

inside

  • in markdown output 43 | tightListClass: 'tight', // Add class to