File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
Expand file tree Collapse file tree 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(
308308 const pluginSettings = settings . uiSettings [ `plugin-${ plugin . id } ` ] ;
309309 $page . body = view ( {
310310 ...plugin ,
311- body : markdownIt ( { html : true , xhtmlOut : true } )
311+ body : markdownIt ( {
312+ html : true ,
313+ xhtmlOut : true ,
314+ } )
312315 . use ( MarkdownItGitHubAlerts )
313316 . use ( anchor , {
314317 slugify : ( s ) =>
@@ -394,6 +397,28 @@ export default async function PluginInclude(
394397 copyButton . className = "copy-button" ;
395398 copyButton . textContent = "Copy" ;
396399
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+
397422 copyButton . addEventListener ( "click" , async ( ) => {
398423 const code = pre . querySelector ( "code" ) ?. textContent || pre . textContent ;
399424 try {
Original file line number Diff line number Diff line change 191191 word-wrap : normal ;
192192 white-space : pre ;
193193 font-size : 0.8rem ;
194- padding : 5px ;
194+ border-radius : 4px ;
195+ padding : 1em ;
195196 margin : 5px 0 ;
196197 background : var (--primary-color );
197198 color : var (--primary-text-color );
198- border-left : solid 5px var (--active-color );
199+ /* border-left: solid 5px var(--active-color); */
199200 overflow : auto ;
200201 width : calc (100% - 10px );
201202 display : block ;
202203 user-select : text ;
204+ div {
205+ background : var (--primary-color );
206+ }
203207 }
204208 }
205209 }
Original file line number Diff line number Diff line change 4747 type ,
4848 listener ,
4949 useCapture ,
50- allowed
50+ allowed ,
5151 ) {
5252 if ( typeof useCapture === "boolean" ) {
5353 allowed = useCapture ;
101101 < script src ="./js/ace/ext-error_marker.js "> </ script >
102102 < script src ="./js/ace/ext-whitespace.js "> </ script >
103103 < script src ="./js/ace/ext-static_highlight.js "> </ script >
104+ < script src ="./js/ace/ext-inline_autocomplete.js "> </ script >
104105
105106 < script >
106107 var color = localStorage . getItem ( "__primary_color" ) ;
You can’t perform that action at this time.
0 commit comments