From 1f0242c6ea9fc6cc066276437a7628f68c4aa98e Mon Sep 17 00:00:00 2001 From: Lee Moody Date: Wed, 8 Aug 2018 01:25:32 +0100 Subject: [PATCH] fix(gfm-codeblock): add support for spaces before language declaration One or more spaces before the language declaration of a code block is supported by Github. E.g. ``` html
HTML!
``` ``` html
HTML!
``` ```html
HTML!
``` Closes #569 --- dist/showdown.js | Bin 166061 -> 166005 bytes dist/showdown.js.map | Bin 459530 -> 459544 bytes dist/showdown.min.js | Bin 82605 -> 82610 bytes dist/showdown.min.js.map | Bin 86972 -> 86972 bytes src/subParsers/makehtml/githubCodeBlocks.js | 2 +- .../standard/github-style-codeblock.html | 5 +++++ .../cases/standard/github-style-codeblock.md | 8 ++++++++ 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dist/showdown.js b/dist/showdown.js index 2e0f6bf4ab886ee630d37ccc328cd40495181e35..5f9334c6450a4b31b931a74192d1b7e58bc74d63 100644 GIT binary patch delta 727 zcmY+AZAepb6vlbZ?se_DoW*DjZCw`5-PLer*>JcrLNFW{6^ShiCPIVOi}nIxFOVcj zq%ipVAtWn5g@uS7D1so0upl82p`ziZq!&hF5PhiYy~3{F{^xnl^W!=Hu|Z{NKp9ZI zwc$uKyggDKRYO%uu=9K-)qV1GCa7H=k3IDa#>ywwZ`=@=(BkJl^W8FNCHz{0=H&cN zT$Dws20rm64w?I7n3p-zfVj+Kjc^nRefy}GPQcB91RmIV`Vc*k8idZN zVqY7s5)UWgwDF_kcx>ag6!zPAv=e@b-=xt<((XDn#LiO~kxa&kcaV7IEV?0b{qS;o z7iP#}9k_s^!tCPSOPDO?*bO|ivmWR$t8nTLu9q5JdCxs~h+FTY+GTS7{ep{m98JZH z=h))oijPRh+?7K!@r!v>I{521%&r{q^9QnPmV=u`%OckDli%ndcK<=2-M~#gqoq>g z#qZaVe(5JSg^h+@amGsy-sYi@IkP_h#qzFciE9y3#84T%U9CytRyiFkXj7XgZH?u& zlAW_Y8nuc^m7;|Rvq}pVn_v1VZ*4VOK|Mr@B1Zh=7pjkB?g>(}(}MWEgRWQ*;&v@% z3${qsP>Ilg!^!Qt=!j*J=c23o=Hog&T}KVZKd#)aiwe)}rNh=_%RU;Cd7+8w>$&nK L9fRoYqX3luSM23} delta 759 zcmYjPT}V`65amp|>UFOslt1le+b){BAiGwqKcSI?w5H`lk=idu; z6&G#|6_t1bLDMK`zS!P$;mo=A0{>MrUOJWqv%l0mlAfKJ4|621qU#GxH5J2Q^>P8p z{M&^I6DGg*!|xPkx&cAX4r5QE1o0x|s-16;$lW_IBN;xm3l$pgS0Tk=3$?b=dUn@h zC`p*{1Ng8;u)iL45EQ{-66`$!r_K)?$FRmo6RI`dZiY8OaI^(g#AriIB30CjP5i18 zmqkLoy@?#&e;!k!V==0?8>t+*gk??ZTD80vNvdvAJ`-mVRvm)~sXx(wIR}5gg344G z;*a8iHYtiH^>As8tre7ebZK$HOs*e-D_sI>d&e`RaV(B%-9GyQzFa})XVmH|G<-!3 zC7VVt5HLIeH9ZF}znj5wvT&1g_^92<{`b_>Hy9k5hg%r6d0uvl{zRuf%hE6Oh$Cy* z=m0H=8|$BkGswEv*g7iI)-pWg<&-Q6tOf^j=!c%58Fj)<398LS@Bd32vfDnnsb!_o zr=AAL!L7OUa3#}dSKac^tgXj)y|l18>2V%iBQg!O7$%?U*g%O~S3ouTy;!!!x6^gI zQymM_9os~38>O+gn3`;sAC*{EIHQbC>thIR;lWC3v?|KT#~XK((#L%sq4ILU#T#@~ LllyuoUp)K;Fz(dc diff --git a/dist/showdown.js.map b/dist/showdown.js.map index ec138f87f67b47ec3c6c07459bad5f199b0334cd..945e95a5e083fbad38ae067643dc09c920466b1a 100644 GIT binary patch delta 76 zcmeBblbO*b)6l}Wg~`op`qLUF{>eFM{F4(hM5Y&bF;z2Vc}}0G&a5(d!gl_41#c!G eW(H!G?F!zk()6l}Wg~`opvW_dy^aY+wtdo0$L?$;((w)A*iz%4N*kihb7K_T{3ETPG dHN2UCm>Gy!wrhB^PM^?z^fv4Eqqo_D)d9rb8WjKl diff --git a/dist/showdown.min.js b/dist/showdown.min.js index f247d698b03aa8ef5e0edc6cec839ad04327d1b0..834b07b2510ff14557f8d0414c03efd2a11474e5 100644 GIT binary patch delta 29 lcmZ46%DSnQb%H#LnXZAwM&+v~S?sM8v^IY`xwV3k3jm&03e^Ar delta 25 hcmdng%DT3db%H#LxvqivM&+v~H~%}ixq^w83jl#C3L*di diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index d2d24441bed40d6684eb2cec87ad4ac6eadcfda9..3ca44a7849b2428de7114b5598daabdb3f0ff25b 100644 GIT binary patch delta 54 zcmdn9oORD~)(y26)k|F*9m`#Gf*l=0Eu3^*9UUXJ%bh{AKbQAnd some HTML

<div>HTML!</div>
 
+

And some CSS with spaces before the language declaration

+
body {
+font-size: 1.5em;
+}
+

Use more than 3 backticks

some code
 
diff --git a/test/functional/makehtml/cases/standard/github-style-codeblock.md b/test/functional/makehtml/cases/standard/github-style-codeblock.md index bae8447..d84cf6d 100644 --- a/test/functional/makehtml/cases/standard/github-style-codeblock.md +++ b/test/functional/makehtml/cases/standard/github-style-codeblock.md @@ -13,6 +13,14 @@ And some HTML
HTML!
``` +And some CSS with spaces before the language declaration + +``` css +body { + font-size: 1.5em; +} +``` + Use more than 3 backticks `````