@@ -155,6 +155,76 @@ hljs.registerLanguage("mlir",function(){"use strict";return function(e){
155155 className :"symbol" , variants :[ { begin :"%" + s + "([:#]\\d+)?" } , { begin :"\\^" + s } , {
156156 begin :"#" + s } ] } , e . C_NUMBER_MODE ] } } } ( ) ) ;
157157
158+ // https://www.renpy.org/doc/html/language_basics.html
159+ // Ren'Py script language support.
160+ hljs . registerLanguage ( "renpy" , ( hljs ) => {
161+ const IDENT = / [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * / ;
162+ const BACKTICK_STRING_MODE = {
163+ className : "string" ,
164+ begin : / ` / ,
165+ end : / ` / ,
166+ contains : [ hljs . BACKSLASH_ESCAPE ]
167+ } ;
168+ const RENPY_KEYWORDS = [
169+ "add" , "at" , "behind" , "call" , "camera" , "centered" , "contains" ,
170+ "default" , "define" , "drag" , "draggroup" , "elif" , "else" , "event" ,
171+ "expression" , "hide" , "hotspot" , "if" , "image" , "init" , "jump" ,
172+ "key" , "label" , "menu" , "nvl" , "on" , "pass" , "python" , "queue" ,
173+ "repeat" , "return" , "scene" , "screen" , "show" , "side" , "sound" ,
174+ "stop" , "style" , "text" , "time" , "timer" , "transform" , "use" ,
175+ "voice" , "while" , "with" , "window" , "zorder"
176+ ] . join ( " " ) ;
177+ const PYTHON_KEYWORDS = [
178+ "and" , "as" , "assert" , "async" , "await" , "break" , "class" ,
179+ "continue" , "def" , "del" , "except" , "False" , "finally" , "for" ,
180+ "from" , "global" , "import" , "in" , "is" , "lambda" , "None" ,
181+ "nonlocal" , "not" , "or" , "raise" , "True" , "try" , "yield"
182+ ] . join ( " " ) ;
183+
184+ return {
185+ name : "Ren'Py" ,
186+ aliases : [ "rpy" ] ,
187+ keywords : {
188+ keyword : `${ RENPY_KEYWORDS } ${ PYTHON_KEYWORDS } ` ,
189+ literal : "True False None yes no" ,
190+ built_in : "Character DynamicCharacter Solid Null Fade Dissolve MoveTransition Pause SetVariable ToggleVariable Show Hide Jump Call Return Function Play Queue Stop"
191+ } ,
192+ contains : [
193+ hljs . HASH_COMMENT_MODE ,
194+ hljs . QUOTE_STRING_MODE ,
195+ hljs . APOS_STRING_MODE ,
196+ BACKTICK_STRING_MODE ,
197+ hljs . NUMBER_MODE ,
198+ {
199+ className : "meta" ,
200+ begin : / ^ \s * \$ + / ,
201+ end : / $ / ,
202+ contains : [
203+ hljs . HASH_COMMENT_MODE ,
204+ hljs . QUOTE_STRING_MODE ,
205+ hljs . APOS_STRING_MODE ,
206+ BACKTICK_STRING_MODE ,
207+ hljs . NUMBER_MODE
208+ ]
209+ } ,
210+ {
211+ className : "section" ,
212+ begin : / ^ \s * ( l a b e l | s c r e e n | t r a n s f o r m | s t y l e | i m a g e ) \s + / ,
213+ end : / : / ,
214+ keywords : "label screen transform style image"
215+ } ,
216+ {
217+ className : "title" ,
218+ begin : new RegExp ( `^\\s*${ IDENT . source } (?=\\s+["'\`])` )
219+ } ,
220+ {
221+ className : "variable" ,
222+ begin : / \[ [ ^ \] \n ] + \] /
223+ }
224+ ]
225+ } ;
226+ } ) ;
227+
158228// https://github.com/siyuan-note/siyuan/pull/15345
159229hljs . registerLanguage ( 'template' , function ( hljs ) {
160230
0 commit comments