我想将 Markdown 解析为 html 并使用语法突出显示。
我的证监会如下:
<template>
<div v-html="html"></div>
</template>
<script>
import marked from 'marked'
import hljs from 'highlightjs';
export default {
name:"Article",
props:['md'],
computed:{
html(){
return marked(this.md)
}
},
created: function () {
marked.setOptions({
langPrefix: '',
highlight: function(code, lang) {
return hljs.highlightAuto(code, [lang]).value
}
})
},
}
</script>
<style src='highlightjs/styles/github-gist.css'></style>
Run Code Online (Sandbox Code Playgroud)
生成的代码块如下所示:
这是 Vuetify 的风格。
https://vuetifyjs.com/en/styles/content/#code
我想禁用或覆盖它。
以下代码不适用于代码块:
<style scoped>
.v-application code {
background-color: unset !important;
color: unset !important;
box-shadow: unset !important;
}
.myclass {
color:red !important;
}
</style>
Run Code Online (Sandbox Code Playgroud)
结果:
我正在用 Vue.js 和 webpack 开发一个网页。当我在单个文件组件中编写样式时Curry.vue,构建失败。
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style scoped>
.tomato {
color: red;
}
</style>
Run Code Online (Sandbox Code Playgroud)
错误信息是?
ERROR in ./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css& (./node_modules/vuetify-loader/lib/loader.js??ref--7-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css&) 12:0
Module parse failed: Unexpected token (12:0)
File was processed with these loaders:
* ./node_modules/vuetify-loader/lib/loader.js
* ./node_modules/vue-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
|
> .tomato {
| color: red;
| }
@ ./src/components/Curry.vue?vue&type=style&index=0&id=4d934a99&scoped=true&lang=css& 1:0-209 1:225-228 1:230-436 1:230-436
@ ./src/components/Curry.vue
@ ./src/index.js …Run Code Online (Sandbox Code Playgroud)