├── .babelrc
├── .editorconfig
├── .eslintrc.js
├── .github
├── FUNDING.yml
└── workflows
│ ├── codeql-analysis.yml
│ └── publish.yml
├── .gitignore
├── LICENSE
├── README.md
├── dist
├── vue-markdown.common.js
├── vue-markdown.common.js.LICENSE.txt
├── vue-markdown.js
└── vue-markdown.js.LICENSE.txt
├── example
├── simple
│ └── index.html
└── webpack-simple
│ ├── .babelrc
│ ├── .gitignore
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ ├── src
│ ├── App.vue
│ └── main.js
│ └── webpack.config.js
├── index.d.ts
├── index.html
├── package.json
├── renovate.json
├── src
├── VueMarkdown.js
└── build.js
├── webpack.common.js
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"],
3 | "plugins": ["@babel/plugin-transform-runtime"]
4 | }
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "env": {
3 | "browser": true,
4 | "es2021": true
5 | },
6 | "extends": [
7 | "plugin:vue/essential",
8 | "standard"
9 | ],
10 | "parserOptions": {
11 | "ecmaVersion": 12,
12 | "sourceType": "module"
13 | },
14 | "plugins": [
15 | "vue"
16 | ],
17 | "rules": {
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [milindsingh]
4 | patreon: adapttive
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ next ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ next ]
20 | schedule:
21 | - cron: '21 19 * * 1'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'javascript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37 | # Learn more:
38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39 |
40 | steps:
41 | - name: Checkout repository
42 | uses: actions/checkout@v2
43 |
44 | # Initializes the CodeQL tools for scanning.
45 | - name: Initialize CodeQL
46 | uses: github/codeql-action/init@v1
47 | with:
48 | languages: ${{ matrix.language }}
49 | # If you wish to specify custom queries, you can do so here or in a config file.
50 | # By default, queries listed here will override any specified in a config file.
51 | # Prefix the list here with "+" to use these queries and those in the config file.
52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
53 |
54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55 | # If this step fails, then you should remove it and run the build manually (see below)
56 | - name: Autobuild
57 | uses: github/codeql-action/autobuild@v1
58 |
59 | # ℹ️ Command-line programs to run using the OS shell.
60 | # 📚 https://git.io/JvXDl
61 |
62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63 | # and modify them (or add more) to build your code if your project
64 | # uses a compiled language
65 |
66 | #- run: |
67 | # make bootstrap
68 | # make release
69 |
70 | - name: Perform CodeQL Analysis
71 | uses: github/codeql-action/analyze@v1
72 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | on: push
2 |
3 | jobs:
4 | publish:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - uses: actions/checkout@v3
8 | - uses: actions/setup-node@v3
9 | with:
10 | node-version: 16
11 | - run: npm install
12 | - run: npm test
13 | - run: npm run build
14 | - uses: JS-DevTools/npm-publish@v1
15 | with:
16 | token: ${{ secrets.NPM_TOKEN }}
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18 | .grunt
19 |
20 | # node-waf configuration
21 | .lock-wscript
22 |
23 | # Compiled binary addons (http://nodejs.org/api/addons.html)
24 | build/Release
25 |
26 | # Dependency directory
27 | node_modules
28 |
29 | # Optional npm cache directory
30 | .npm
31 |
32 | # Optional REPL history
33 | .node_repl_history
34 | package-lock.json
35 |
36 | <<<<<<< HEAD
37 | # Ignore IDE files
38 | =======
39 | # removing idea
40 | >>>>>>> 068da8e... readme updated
41 | .idea
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Chao Lee
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 | # vue-markdown
2 |
3 | [](https://www.npmjs.com/package/vue-markdown@adapttive/)
4 | [](https://www.npmjs.com/package/vue-markdown@adapttive/)
5 | [](https://www.npmjs.com/package/@adapttive/vue-markdown)
6 | [](https://www.npmjs.com/package/@adapttive/vue-markdown)
7 | [](https://www.npmjs.com/package/@adapttive/vue-markdown)
8 |
9 | > If you want vue-markdown for `vue1.X.X`, please checkout [vue-markdown1.X.X](https://github.com/adapttive/vue-markdown/tree/v1).
10 |
11 | A Powerful and Highspeed Markdown Parser for Vue.
12 |
13 | Quick start: `i am a ~~tast~~ **test**.`
14 |
15 | Supported Markdown Syntax:
16 |
17 | * [x] automatic table of contents
18 | * [x] table & class customize
19 | * [x] *SyntaxHighlighter
20 | * [x] definition list
21 | * [x] strikethrough
22 | * [x] GFM task list
23 | * [x] abbreviation
24 | * [x] superscript
25 | * [x] subscript
26 | * [x] footnote
27 | * [x] insert
28 | * [x] emoji
29 | * [x] mark
30 | * [x] *katex
31 |
32 | `*SyntaxHighlighter` work with [Prism](https://prismjs.com) recommend
33 |
34 | `*katex` need add [katex css](https://unpkg.com/katex/dist/katex.min.css).
35 |
36 | # Example
37 |
38 | [simple](https://github.com/adapttive/vue-markdown/blob/master/example/simple)
39 |
40 | [webpack-simple](https://github.com/adapttive/vue-markdown/blob/master/example/webpack-simple)
41 |
42 | [Live Demo](https://adapttive.github.io/vue-markdown/)
43 |
44 | # Installation
45 |
46 | ### Browser globals
47 |
48 | > The **dist** folder contains `vue-markdown.js` with the component exported in the `window.VueMarkdown` object.
49 |
50 | ```html
51 |
52 | i am a ~~tast~~ **test**.
53 |
54 |
55 |
56 |
62 | ```
63 |
64 | ### NPM
65 |
66 | ```shell
67 | $ npm install --save @adapttive/vue-markdown
68 | ```
69 |
70 | ### Yarn
71 |
72 | ```shell
73 | $ yarn add @adapttive/vue-markdown --save
74 | ```
75 |
76 | ### Migrating from vue-markdown 2.3
77 |
78 | - You just need to replace the dependencies in `package.json`:
79 |
80 | ```
81 | {
82 | "dependencies": {
83 | - "vue-markdown": "^2.2.4
84 | + "vue-markdown": "npm:@adapttive/vue-markdown@^X.X.X"
85 | }
86 | }
87 | ```
88 |
89 | ## CommonJS
90 |
91 | ```js
92 | var VueMarkdown = require('@adapttive/vue-markdown');
93 |
94 | new Vue({
95 | components: {
96 | 'vue-markdown': VueMarkdown
97 | }
98 | })
99 | ```
100 |
101 | ## ES6 (Vue-CLI users)
102 |
103 | After installing via Yarn or NPM, use the following snippet in the script portion of the Vue component which you wish to render the Markdown.
104 |
105 | ```js
106 | import VueMarkdown from '@adapttive/vue-markdown'
107 |
108 | new Vue({
109 | components: {
110 | VueMarkdown
111 | }
112 | })
113 | ```
114 |
115 | # Slots
116 |
117 | ```html
118 | this is the default slot
119 | ```
120 |
121 | After setting up the middleware in your vue component above, using the embedded markdown is as easy as writing it between the `vue-markdown` tags.
122 |
123 | VueMarkdown has a default slot which is used to write the `markdown` source.
124 |
125 | TIP: The default slot only renders **once** at the beginning, and it will overwrite the prop of `source`!
126 |
127 | # Props
128 |
129 | | Prop | Type | Default | Describe |
130 | | ---------------------- | ------------------------ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
131 | | watches | Array | `["source", "show", "toc"]` | HTML refresh automatically when the prop in this array changed |
132 | | source | String | `null` | the markdown source code |
133 | | show | Boolean | `true` | enable render to the default slot automatically |
134 | | html | Boolean | `true` | enable HTML syntax in source |
135 | | xhtml-out | Boolean | `true` | ` ` => ` ` |
136 | | breaks | Boolean | `true` | `\n` => ` ` |
137 | | linkify | Boolean | `true` | autoconvert URL-like text to link |
138 | | emoji | Boolean | `true` | `:)` => `😃` |
139 | | typographer | Boolean | `true` | enable some language-neutral replacement and quotes beautification |
140 | | update-prism | Boolean | `true` | if true, vue-markdown will automatically call a re-render of all code blocks through Prism.js ([Using Prism.js](#using-prism.js)) |
141 | | lang-prefix | String | `language-` | CSS language prefix for fenced blocks |
142 | | quotes | String | `“”‘’` | use `“”‘’` for Chinese, `„“‚‘` for German, `«»„“` for Russian |
143 | | table-class | String | `table` | customize html class of the `
` |
144 | | task-lists | Boolean | `true` | Makes GFM task lists mutable, `false` shows GFM as readonly checkboxes |
145 | | toc | Boolean | `false` | enable automatic table of contents |
146 | | toc-id | String | `undefined` | the HTML id to render TOC |
147 | | toc-class | String | `table` | customize html class of the `
` wrapping the TOC |
148 | | toc-first-level | Number | `2` | use `2` if you want to skip `
` from the TOC |
149 | | toc-last-level | Number | `'toc-first-level' + 1` | use `5` if you want to skip `
` from the TOC |
150 | | toc-anchor-link | Boolean | `true` | enable the automatic anchor link in the headings |
151 | | toc-anchor-class | String | `toc-anchor` | customize the anchor class name |
152 | | toc-anchor-link-symbol | String | `#` | customize the anchor link symbol |
153 | | toc-anchor-link-space | Boolean | `true` | enable inserting a space between the anchor link and heading |
154 | | toc-anchor-link-class | String | `toc-anchor-link` | customize the anchor link symbol class name |
155 | | toc-anchor-link-before | Boolean | `true` | allows you to prepend/append the anchor link in the headings |
156 | | anchorAttributes | Object | `{}` | anchor tag attributes such as `target: '_blank'` or `rel: 'nofollow'` |
157 | | prerender | Function (String) String | `null` | filter function before markdown parse |
158 | | postrender | Function (String) String | `null` | filter function after markdown parse |
159 | | inline | Boolean | `false` | result will NOT be wrapped into `
` tags |
160 |
161 | # Events
162 |
163 | | Name | Param[Type] | Describe |
164 | | ---- | --------- | -------- |
165 | | rendered | outHtml[String] | dispatch when render finish |
166 | | toc-rendered | tocHtml[String] | dispatch when TOC render finish, never dispatch if the toc[prop] is `false` |
167 |
168 | # Using Prism.js
169 |
170 | 1. Visit the [download page](https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript)
171 | 2. Select all the options that apply for your project
172 | 3. At the bottom of the page download both the JS and CSS
173 | 4. Include them in your `index.html` **MAKE SURE to include Prism before your** `app.js`
174 |
175 |
176 | # Plugins
177 |
178 | ```html
179 |
180 |