@@ -36,24 +36,6 @@ import type { Mode, Lines } from './utils'
3636// @ts-ignore
3737Prism .manual = true
3838
39- // Prism.hooks.add('before-tokenize', function (env) {
40- // if (env.code.match(new RegExp(`${MODIFIED_START_TAG}`, 'gi'))) {
41- // const code = env.code
42- // const pureCode = env.code
43- // .replace(new RegExp(`${MODIFIED_START_TAG}`, 'gi'), '')
44- // .replace(new RegExp(`${MODIFIED_CLOSE_TAG}`, 'gi'), '')
45-
46- // env._modified = code
47- // env.code = pureCode
48- // }
49- // })
50-
51- // Prism.hooks.add('after-tokenize', function (env) {
52- // if (env._modified) {
53- // console.log(env)
54- // }
55- // })
56-
5739export default defineComponent ({
5840 props: {
5941 mode: {
@@ -73,26 +55,21 @@ export default defineComponent({
7355 const getHighlightCode = (value : string , data ? : Lines , index ? : number ) => {
7456 if (! value ) return ' \n '
7557
76- let code = value
77-
78- if (data ) { // Diff words
79- const diffIndex = index === 0 ? 1 : 0
80- const diffValue = data [diffIndex ].value
58+ const code = value
8159
82- if (diffValue ) { // Wrap custom highlight
83- code = renderWords (diffValue , value )
84- }
85- }
60+ // if (data) { // Diff words
61+ // const diffIndex = index === 0 ? 1 : 0
62+ // const diffValue = data[diffIndex].value
8663
87- const grammer = Prism .languages [props .language ]
88- const highlightCode = Prism .highlight (code , grammer , props .language )
64+ // if (diffValue) { // Wrap custom highlight
65+ // code = renderWords(diffValue, value)
66+ // }
67+ // }
8968
90- const regexStartTag = Prism .Token . stringify ( Prism . util . encode ( Prism . tokenize ( MODIFIED_START_TAG , grammer )), props .language )
91- const regexCloseTag = Prism .Token . stringify ( Prism . util . encode ( Prism . tokenize ( MODIFIED_CLOSE_TAG , grammer )) , props .language )
69+ const grammar = Prism .languages [ props .language ]
70+ const highlightCode = Prism .highlight ( code , grammar , props .language )
9271
9372 return highlightCode
94- // .replace(new RegExp(`${regexStartTag}`, 'gi'), '<span class="token modified">')
95- // .replace(new RegExp(`${regexCloseTag}`, 'gi'), '</span>')
9673 }
9774
9875 return {
@@ -115,41 +92,31 @@ td {
11592 font-size : 0.9em ;
11693 }
11794
118- & .code {
119- width : calc (100% - 2em );
120- }
121-
12295 pre [class *= " language-" ]:before {
12396 display : inline-block ;
12497 position : absolute ;
12598 left : 0 ;
12699 top : 0 ;
127100 opacity : 0.8 ;
128101 }
129- }
130102
131- tr .vue-diff-row-split {
132- td .code {
133- width : calc (50% - 2em );
103+ pre [class *= " language-" ] {
104+ display : block ;
105+ position : relative ;
106+ max-width : 100% ;
107+ margin : 0 ;
108+ padding : 0 ;
109+ padding-left : 1.5em ;
110+ overflow : visible ;
111+ background : none ;
112+ border-radius : 0 ;
134113 }
135- }
136-
137- pre [class *= " language-" ] {
138- display : block ;
139- position : relative ;
140- max-width : 100% ;
141- margin : 0 ;
142- padding : 0 ;
143- padding-left : 1.5em ;
144- overflow : visible ;
145- background : none ;
146- border-radius : 0 ;
147- }
148114
149- code {
150- word-wrap : break-all ;
151- word-break : break-all ;
152- white-space : pre-wrap ;
115+ code {
116+ word-wrap : break-all !important ;
117+ word-break : break-all !important ;
118+ white-space : pre-wrap !important ;
119+ }
153120}
154121
155122td .vue-diff-cell-removed {
0 commit comments