File tree 3 files changed +34
-4
lines changed
3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,10 @@ export default async function PluginInclude(
308
308
const pluginSettings = settings . uiSettings [ `plugin-${ plugin . id } ` ] ;
309
309
$page . body = view ( {
310
310
...plugin ,
311
- body : markdownIt ( { html : true , xhtmlOut : true } )
311
+ body : markdownIt ( {
312
+ html : true ,
313
+ xhtmlOut : true ,
314
+ } )
312
315
. use ( MarkdownItGitHubAlerts )
313
316
. use ( anchor , {
314
317
slugify : ( s ) =>
@@ -394,6 +397,28 @@ export default async function PluginInclude(
394
397
copyButton . className = "copy-button" ;
395
398
copyButton . textContent = "Copy" ;
396
399
400
+ const codeElement = pre . querySelector ( "code" ) ;
401
+ if ( codeElement ) {
402
+ const langMatch = codeElement . className . match (
403
+ / l a n g u a g e - ( \w + ) | ( j a v a s c r i p t ) / ,
404
+ ) ;
405
+ if ( langMatch ) {
406
+ const langMap = {
407
+ bash : "sh" ,
408
+ shell : "sh" ,
409
+ } ;
410
+ const lang = langMatch [ 1 ] || langMatch [ 2 ] ;
411
+ const mappedLang = langMap [ lang ] || lang ;
412
+ const highlight = ace . require ( "ace/ext/static_highlight" ) ;
413
+ highlight ( codeElement , {
414
+ mode : `ace/mode/${ mappedLang } ` ,
415
+ theme : settings . value . editorTheme . startsWith ( "ace/theme/" )
416
+ ? settings . value . editorTheme
417
+ : "ace/theme/" + settings . value . editorTheme ,
418
+ } ) ;
419
+ }
420
+ }
421
+
397
422
copyButton . addEventListener ( "click" , async ( ) => {
398
423
const code = pre . querySelector ( "code" ) ?. textContent || pre . textContent ;
399
424
try {
Original file line number Diff line number Diff line change 191
191
word-wrap : normal ;
192
192
white-space : pre ;
193
193
font-size : 0.8rem ;
194
- padding : 5px ;
194
+ border-radius : 4px ;
195
+ padding : 1em ;
195
196
margin : 5px 0 ;
196
197
background : var (--primary-color );
197
198
color : var (--primary-text-color );
198
- border-left : solid 5px var (--active-color );
199
+ /* border-left: solid 5px var(--active-color); */
199
200
overflow : auto ;
200
201
width : calc (100% - 10px );
201
202
display : block ;
202
203
user-select : text ;
204
+ div {
205
+ background : var (--primary-color );
206
+ }
203
207
}
204
208
}
205
209
}
Original file line number Diff line number Diff line change 47
47
type ,
48
48
listener ,
49
49
useCapture ,
50
- allowed
50
+ allowed ,
51
51
) {
52
52
if ( typeof useCapture === "boolean" ) {
53
53
allowed = useCapture ;
101
101
< script src ="./js/ace/ext-error_marker.js "> </ script >
102
102
< script src ="./js/ace/ext-whitespace.js "> </ script >
103
103
< script src ="./js/ace/ext-static_highlight.js "> </ script >
104
+ < script src ="./js/ace/ext-inline_autocomplete.js "> </ script >
104
105
105
106
< script >
106
107
var color = localStorage . getItem ( "__primary_color" ) ;
You can’t perform that action at this time.
0 commit comments