@@ -89,6 +89,10 @@ export const copy = ({
89
89
Decoration . mark ( {
90
90
class : "cm-copy-html-tag" ,
91
91
} ) ;
92
+ const instructionDecoration = ( ) =>
93
+ Decoration . mark ( {
94
+ class : "cm-instruction" ,
95
+ } ) ;
92
96
const rawLinkDecoration = ( url : string ) =>
93
97
Decoration . mark ( {
94
98
tagName : "a" ,
@@ -127,6 +131,10 @@ export const copy = ({
127
131
Decoration . line ( {
128
132
class : "cm-copy-blockquote" ,
129
133
} ) ;
134
+ const codeBlockStartDecoration = ( ) =>
135
+ Decoration . line ( {
136
+ class : "cm-code-start" ,
137
+ } ) ;
130
138
const codeBlockDecoration = ( ) =>
131
139
Decoration . line ( {
132
140
class : "cm-code" ,
@@ -198,6 +206,10 @@ export const copy = ({
198
206
const newDecoration = linkDecoration ( text , linkText , absoluteUrl ) ;
199
207
widgets . push ( newDecoration . range ( from , to ) ) ;
200
208
}
209
+ } else if ( type . name === "CodeInfo" ) {
210
+ let text = state . doc . sliceString ( from , to ) ;
211
+ const newDecoration = instructionDecoration ( ) ;
212
+ widgets . push ( newDecoration . range ( from , to ) ) ;
201
213
} else if ( type . name === "URL" ) {
202
214
let text = state . doc . sliceString ( from , to ) ;
203
215
const endOfLink = / \) / . exec ( text ) ;
@@ -225,6 +237,9 @@ export const copy = ({
225
237
const linePosition = state . doc . lineAt ( i ) ;
226
238
widgets . push ( newDecoration . range ( linePosition . from ) ) ;
227
239
}
240
+ const newStartDecoration = codeBlockStartDecoration ( ) ;
241
+ const previousLineFrom = state . doc . lineAt ( fromLine . from - 1 ) . from ;
242
+ widgets . push ( newStartDecoration . range ( previousLineFrom ) ) ;
228
243
// widgets.push(newDecoration.range(from));
229
244
} else if ( [ "HTMLTag" , "HTMLBlock" ] . includes ( type . name ) ) {
230
245
let text = state . doc . sliceString ( from , to ) ;
0 commit comments