├── .circleci └── config.yml ├── .editorconfig ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── index.js ├── package.json ├── test ├── index.js ├── integrations │ ├── github │ │ ├── input.md │ │ └── output.html │ └── toc │ │ ├── input.md │ │ └── output.html └── vue │ └── v2.5 │ ├── fixtures │ ├── blockquote │ │ ├── input.md │ │ └── output.html │ ├── code │ │ ├── input.md │ │ └── output.html │ ├── entities-named │ │ ├── input.md │ │ └── output.html │ ├── entities │ │ ├── input.md │ │ └── output.html │ ├── escape-commonmark │ │ ├── config.json │ │ ├── input.md │ │ └── output.html │ ├── escape │ │ ├── input.md │ │ └── output.html │ ├── footnotes │ │ ├── config.json │ │ ├── input.md │ │ └── output.html │ ├── html-sanitize │ │ ├── input.md │ │ └── output.html │ ├── html │ │ ├── input.md │ │ └── output.html │ ├── images │ │ ├── input.md │ │ └── output.html │ ├── links │ │ ├── input.md │ │ └── output.html │ ├── list │ │ ├── input.md │ │ └── output.html │ ├── references │ │ ├── input.md │ │ └── output.html │ ├── rule │ │ ├── input.md │ │ └── output.html │ ├── tables │ │ ├── input.md │ │ └── output.html │ ├── xhtml │ │ ├── config.json │ │ ├── input.md │ │ └── output.html │ └── yaml │ │ ├── input.md │ │ └── output.html │ ├── index.js │ ├── package.json │ └── yarn.lock └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | defaults: &defaults 4 | working_directory: /usr/src/app 5 | docker: 6 | - image: node:10 7 | 8 | jobs: 9 | build-job: 10 | <<: *defaults 11 | steps: 12 | # Checkout repository 13 | - checkout 14 | 15 | # Restore cache 16 | - restore_cache: 17 | key: yarn-{{ checksum "yarn.lock" }} 18 | 19 | # Disable yarn progress bar for perf 20 | - run: 21 | command: yarn config set no-progress 22 | 23 | # Disable yarn engine compatibility errors 24 | - run: 25 | command: yarn config set ignore-engines true 26 | 27 | # Greenkeeper-lockfile 28 | - run: 29 | name: Installing Greenkeeper-lockfile 30 | command: yarn global add greenkeeper-lockfile@1 31 | 32 | # Install codecov 33 | - run: 34 | name: Installing codecov 35 | command: yarn global add codecov 36 | 37 | # Install dependencies 38 | - run: 39 | name: Installing Dependencies 40 | command: yarn 41 | 42 | # Keep cache 43 | - save_cache: 44 | key: yarn-{{ checksum "yarn.lock" }} 45 | paths: 46 | - "node_modules" 47 | 48 | # Update yarn.lock 49 | - run: 50 | name: Updating lockfile 51 | command: greenkeeper-lockfile-update 52 | 53 | # Test 54 | - run: 55 | name: Testing 56 | command: yarn test 57 | 58 | # Upload yarn.lock 59 | - run: 60 | name: Uploading lockfile 61 | command: greenkeeper-lockfile-upload 62 | 63 | # Upload coverage 64 | - run: 65 | name: Uploading coverage 66 | command: codecov 67 | 68 | - persist_to_workspace: 69 | root: /usr/src/app 70 | paths: . 71 | 72 | deploy-job: 73 | <<: *defaults 74 | steps: 75 | - attach_workspace: 76 | # Must be absolute path or relative path from working_directory 77 | at: /usr/src/app 78 | 79 | - run: 80 | name: Authenticating with registry 81 | command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc 82 | 83 | - run: 84 | name: Publishing package 85 | command: npm publish 86 | 87 | workflows: 88 | version: 2 89 | build: 90 | jobs: 91 | - build-job: 92 | filters: 93 | tags: 94 | only: /^v.*/ 95 | - deploy-job: 96 | requires: 97 | - build-job 98 | filters: 99 | tags: 100 | only: /^v.*/ 101 | branches: 102 | ignore: /.*/ -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*].html 12 | insert_final_newline = false 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | .nyc_output/ 4 | coverage/ 5 | node_modules/ 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | src/ 3 | .nyc_output/ 4 | coverage/ 5 | test/ 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | 6 | ## [0.9.4](https://github.com/medfreeman/remark-vue/compare/v0.9.3...v0.9.4) (2018-09-03) 7 | 8 | 9 | ### Bug Fixes 10 | 11 | * **test:** update snapshots ([34e2c24](https://github.com/medfreeman/remark-vue/commit/34e2c24)) 12 | 13 | 14 | 15 | 16 | ## [0.9.3](https://github.com/medfreeman/remark-vue/compare/v0.9.2...v0.9.3) (2018-09-03) 17 | 18 | 19 | ### Bug Fixes 20 | 21 | * remove unneeded `div` wrapper ([646ed8a](https://github.com/medfreeman/remark-vue/commit/646ed8a)) 22 | 23 | 24 | 25 | 26 | ## [0.9.2](https://github.com/medfreeman/remark-vue/compare/v0.9.1...v0.9.2) (2018-09-03) 27 | 28 | 29 | 30 | 31 | ## [0.9.1](https://github.com/medfreeman/remark-vue/compare/v0.9.0...v0.9.1) (2018-09-03) 32 | 33 | 34 | 35 | 36 | ## 0.9.0 (2018-09-03) 37 | 38 | Test release :rocket: 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2015 Mapbox 4 | Copyright (c) 2015 Titus Wormer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # remark-vue 2 | 3 | [![npm version](https://badgen.net/npm/v/remark-vue)](https://www.npmjs.com/package/remark-vue) 4 | [![npm](https://badgen.net/npm/dt/remark-vue)](https://npmjs.com/package/remark-vue) 5 | [![Build Status](https://badgen.net/circleci/github/medfreeman/remark-vue/vuejs)](https://circleci.com/gh/medfreeman/remark-vue) 6 | [![Codecov](https://badgen.net/codecov/c/github/medfreeman/remark-vue/vuejs)](https://codecov.io/gh/medfreeman/remark-vue/branch/vuejs) 7 | [![Greenkeeper badge](https://badges.greenkeeper.io/medfreeman/remark-vue.svg)](https://greenkeeper.io/) 8 | [![Dependencies](https://badgen.net/david/dep/medfreeman/remark-vue)](https://david-dm.org/medfreeman/remark-vue) 9 | [![devDependencies](https://badgen.net/david/dev/medfreeman/remark-vue)](https://david-dm.org/medfreeman/remark-vue?type=dev) 10 | 11 | > Compile Markdown to Vue with remark 12 | 13 | [📖 **Release Notes**](./CHANGELOG.md) 14 | 15 | ## Features 16 | 17 | **remark-vue** compiles markdown to Vue. Built on [**remark**](https://github.com/remarkjs/remark), 18 | an extensively tested and pluggable parser. 19 | 20 | **Why?** Using `domPropsInnerHTML` in 21 | [Vue.js](https://vuejs.org/) is a common cause of [XSS](https://en.wikipedia.org/wiki/Cross-site_scripting) 22 | attacks: user input can include script tags and other kinds of active 23 | content that reaches across domains and harms security. remark-vue 24 | builds a DOM in Vue, using [Vue createElement](https://vuejs.org/v2/guide/render-function.html#Nodes-Trees-and-the-Virtual-DOM): 25 | this means that you can display parsed & formatted Markdown content 26 | in an application without using `domPropsInnerHTML`. 27 | 28 | ## Installation 29 | 30 | [npm](https://docs.npmjs.com/cli/install): 31 | 32 | ```bash 33 | npm install remark-vue 34 | ``` 35 | 36 | ## Table of Contents 37 | 38 | * [Programmatic](#programmatic) 39 | 40 | * [remark.use(vue, options)](#remarkusevue-options) 41 | 42 | * [Configuration](#configuration) 43 | 44 | * [Integrations](#integrations) 45 | 46 | * [License](#license) 47 | 48 | ## Programmatic 49 | 50 | ### [remark](https://github.com/wooorm/remark#api).[use](https://github.com/wooorm/remark#remarkuseplugin-options)(vue, [options](#configuration)) 51 | 52 | **Parameters** 53 | 54 | * `vue` — This plugin; 55 | * `options` (`Object?`) — See [below](#configuration). 56 | 57 | Let’s say `example.js` looks as follows: 58 | 59 | ```js 60 | var Vue = require('vue'), 61 | remark = require('remark'), 62 | vueRenderer = require('remark-vue'); 63 | 64 | var App = new Vue({ 65 | el: '#app', 66 | data: function () { 67 | return { 68 | text: '# hello world' 69 | } 70 | }, 71 | onChange(e) { 72 | this.text = e.target.value; 73 | }, 74 | render() { 75 | return (
76 |