Merge pull request #2250 from clarkdo/dev

refactor: improve markdown example
This commit is contained in:
Sébastien Chopin 2017-11-27 08:41:33 +01:00 committed by GitHub
commit 47dfc5c003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 14 deletions

View File

@ -1,16 +1,8 @@
module.exports = {
modules: [
'@nuxtjs/markdownit'
],
plugins: [
'~/plugins/md-it'
]
// [optional] markdownit options
// See https://github.com/markdown-it/markdown-it
// markdownit: {
// preset: 'default',
// linkify: true,
// breaks: true,
// use: [
// 'markdown-it-container',
// 'markdown-it-attrs'
// ]
// }
}

View File

@ -10,5 +10,8 @@
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start"
},
"devDependencies": {
"jstransformer-markdown-it": "^2.0.0"
}
}

View File

@ -1,8 +1,10 @@
<template lang="pug">
div
h1 Pug Page
div(language="md") Current route is: {{ $route.name }}
div(language="md") Data model is: {{ model }}
:markdown-it()
## Current route is: {{ $route.name }}
div(v-html="$md.render(model)")
br
nuxt-link(to='/') Back Home
</template>
@ -11,7 +13,7 @@
export default {
data() {
return {
model: 'I am pug'
model: '## Title h2\n### title h3\n\nLong text Long text Long text Long text Long text Long text Long text Long text Long text \n\n* gimme a list item\n* and one more yeehaw'
}
}
}

View File

@ -0,0 +1,5 @@
import MarkdownIt from 'markdown-it'
export default ({ app }, inject) => {
inject('md', new MarkdownIt())
}