From 3f39bfeae79c500e3ffe6cb88a7213099a4e554f Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Mon, 16 Jun 2025 20:18:05 -0700 Subject: [PATCH] Add test for syntax highlighting moonscript code block --- spec/renderers_spec.moon | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/spec/renderers_spec.moon b/spec/renderers_spec.moon index f1b091f..710f65b 100644 --- a/spec/renderers_spec.moon +++ b/spec/renderers_spec.moon @@ -32,32 +32,40 @@ print("hello world") assert.same [[
print("hello world")
]], out + it "syntax highlights moonscript code", -> + out = flatten_html render [[ +```moonscript +print "Hi, #{@name}!" +```]] + + assert.same [[
print"Hi, #{@name}!"
]], out + it "doesnt highlight code inside of a cosmo template", -> site.user_vars.hello = (_, args) -> { template } = args template out = flatten_html render [=[ +```lua +print 5 +``` +$hello{[[ ```lua - print 5 + print thing ``` - $hello{[[ - ```lua - print thing - ``` - ]]}]=] +]]}]=] assert.same [=[
print5

- ```lua - print thing - ``` -

]=], out + ```lua + print thing + ``` +

]=], out it "doesn't highlight unrecognized code languages", -> out = flatten_html render [[ - ```snickerdoodle - this code block has an unknown label - ```]] +```snickerdoodle +this code block has an unknown label +```]] assert.same [[
this code block has an unknown label
]], out