d2-highlight组件升级
Former-commit-id: 0c3195d9081d1086bdcef0f6db874d55aee835f6 [formerly 0c3195d9081d1086bdcef0f6db874d55aee835f6 [formerly 0c3195d9081d1086bdcef0f6db874d55aee835f6 [formerly 0c3195d9081d1086bdcef0f6db874d55aee835f6 [formerly 12da068299ba55d5e662f8a8632f1306e5b39723 [formerly 3d78de523eae0503b225f4c265bd0089c6f6c9a5]]]]] Former-commit-id: 3acd78000fea252d22e913ef9152183ef2f58299 Former-commit-id: 7ae7ca4ff120db811bff52abe9d27801deb331b4 Former-commit-id: 513d9e25f4e5dbf8cd02538e4864f3c2bfcfb05c [formerly 4b6d9a82ba2bcb2e6ee3e75de1182ff506c23117] Former-commit-id: 1e582207ed544ff95f130003cce03bdf44f9ff81 Former-commit-id: 4d62c9765b14ef177e38e8dc66a9cc60221c9363 Former-commit-id: 8cd32b00b58cbd576dc781cf41b79744e25dae5e Former-commit-id: ef79a906d90ec80c9484816c7781d9794bfe000b Former-commit-id: 5e959e1e6f1e9d21f6c478a0f5b83965d81d96b4
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<script>
|
||||
// https://highlightjs.org/usage/
|
||||
// http://highlightjs.readthedocs.io/en/latest/api.html#configure-options
|
||||
import htmlFormat from './libs/htmlFormat'
|
||||
import highlight from 'highlight.js'
|
||||
export default {
|
||||
name: 'd2-highlight',
|
||||
@@ -13,6 +14,11 @@ export default {
|
||||
type: String,
|
||||
required: false,
|
||||
default: `console.log('you lost code prop')`
|
||||
},
|
||||
format: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
@@ -30,7 +36,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
highlight () {
|
||||
this.highlightHTML = highlight.highlightAuto(this.code).value
|
||||
const code = this.format ? htmlFormat(this.code) : this.code
|
||||
this.highlightHTML = highlight.highlightAuto(code).value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
637e1ab54544a3296a996a352314ab659e5b43a2
|
||||
Reference in New Issue
Block a user