mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: improve markdown example
This commit is contained in:
parent
6a3e86e14d
commit
653c2f0e3c
@ -1,16 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
modules: [
|
modules: [
|
||||||
'@nuxtjs/markdownit'
|
'@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'
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,8 @@
|
|||||||
"dev": "nuxt",
|
"dev": "nuxt",
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
"start": "nuxt start"
|
"start": "nuxt start"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jstransformer-markdown-it": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
div
|
div
|
||||||
h1 Pug Page
|
h1 Pug Page
|
||||||
div(language="md") Current route is: {{ $route.name }}
|
:markdown-it()
|
||||||
div(language="md") Data model is: {{ model }}
|
## Current route is: {{ $route.name }}
|
||||||
|
div(v-html="$md.render(model)")
|
||||||
|
|
||||||
br
|
br
|
||||||
nuxt-link(to='/') Back Home
|
nuxt-link(to='/') Back Home
|
||||||
</template>
|
</template>
|
||||||
@ -11,7 +13,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
examples/markdownit/plugins/md-it.js
Normal file
5
examples/markdownit/plugins/md-it.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import MarkdownIt from 'markdown-it'
|
||||||
|
|
||||||
|
export default ({ app }, inject) => {
|
||||||
|
inject('md', new MarkdownIt())
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user