From 5e0ed809dbf474ec76ba0c81a418bca663966d1b Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Thu, 24 Feb 2022 01:57:08 +0000 Subject: [PATCH] feat(moreStyling): add some useful classes for css styling Currently, only adds the class `task-list-item-complete` to completed tasks items in GFM tasklists. But in the future, each time a css class is deemed to be necessary, should be added under this umbrella option. Closes #540 --- README.md | 9 +++++---- dist/showdown.js | Bin 205744 -> 206063 bytes dist/showdown.js.map | Bin 590293 -> 591109 bytes dist/showdown.min.js | Bin 97175 -> 97348 bytes dist/showdown.min.js.map | Bin 107530 -> 107646 bytes src/options.js | 5 +++++ src/subParsers/makehtml/lists.js | 13 +++++++++---- .../moreStyling/tasklists-with-styling.html | 4 ++++ .../moreStyling/tasklists-with-styling.md | 2 ++ .../functional/makehtml/testsuite.features.js | 13 +++++++++++++ 10 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 test/functional/makehtml/cases/features/moreStyling/tasklists-with-styling.html create mode 100644 test/functional/makehtml/cases/features/moreStyling/tasklists-with-styling.md diff --git a/README.md b/README.md index f40bfd2..e267f45 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Greenkeeper badge](https://badges.greenkeeper.io/showdownjs/showdown.svg)](https://greenkeeper.io/) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/tiviesantos) ------ @@ -17,11 +16,9 @@ Showdown can be used client side (in the browser) or server side (with NodeJs). Check a live Demo here http://demo.showdownjs.com/ -## [![Patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=11141581) - As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money. -If you like our work and find our library useful, please donate through [patreon](https://www.patreon.com/showdownjs) or directly through [paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated and help me continue to develop this awesome library. +If you like our work and find our library useful, please donate through [paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated and help me continue to develop this awesome library. ## License @@ -369,6 +366,10 @@ var defaultOptions = showdown.getDefaultOptions(); * **splitAdjacentBlockquotes**: (boolean) [default false] Split adjacent blockquote blocks.(since v.1.8.6) + * **moreStyling**: (boolean) [default false] Adds some useful classes for css styling. (since v2.0.1) + + - Tasklists: Adds the class `task-list-item-complete` to completed tasks items in GFM tasklists. + **NOTE**: Please note that until **version 1.6.0**, all of these options are ***DISABLED*** by default in the cli tool. diff --git a/dist/showdown.js b/dist/showdown.js index 76c921d4bbe2ec65bffeb60cbad2bc83b49951d0..eb948b8658aaf4118a6206c501222b63abc10f20 100644 GIT binary patch delta 356 zcmdmRoag;Xo(b29VNCpU5$n-?n-=jWy>loqF^mF6fELu3?^i;ESK za}tY-Q;QWc^At)lQWeru^HPfvOHxx5GD>oDCNE@DY5peK{!Nr|`!`XhNA|4I6%h)t z+wX=lU0{T;rvuq)+i!$36*1~?DL{d~z5>X0u!SiKY57G8C5gq^Ihn;J3Q46oIjJSZ zT+{DIFo{o3jARn4SGR_1%uG|z$S)|#%+D*BLN!Dm#8hot1%>2{)Z}cSGwl`B z!G`OCOxMjUNzK(w&d)6X+L5ZRV5Ok0Ze0sE9nB1NC2&YguZ?7qWdX(494mF xQB1niw?;83Gbt!cUlYqDBND9;QxdBc6RiQ(r)eLnpQ|%@W1;YNxoD<~Cjm;PBPIX< diff --git a/dist/showdown.js.map b/dist/showdown.js.map index e1da0a151afd15477ae44b4a83fa4387e7cbb699..05576ac9a62702337353cd6d4ff8dffe8b67c692 100644 GIT binary patch delta 753 zcmaKpPiPZC6voN!OtaZ)6Y5&5R2?O%T+6ih@>RK@_|ML{A=ydJ>9G5XNZ|1z3@16{q7Qsw`m^mQ z_3V&nWk#a$MUk%TXGpo}UPamD`HQCpAj0upT3l#?;&;vi|uu>aA{{ghs{-&aP-2XY+zt3Hb zLMuuG-MCd3wi#`3Fgk#?gZ_b+SYF9B7>NvqB9SBAaHj_yr~ZVC-bl94@>>z&UA%a6 znHPb)W=TBP`BqAj66C9BVTsM7$UVO%IQx$Iha-_;SZPLk=+FYDrLP#C-e$oI&pDCi z-eU;#B7y53fGc0Polp$(?KJ)j14$t!{*Yby-B^O+0%o7^f_K_$y=c_u=$Q+|ksXNR z;#i}Rozl)&GkQ8R4tq*FP)x$fY_`7wkMtNOD3; zPO^|;BG+`4s<4u_G($;djU1ELWO9(ma_Dl^rUfxbhI6VQqpBU84+?E9BP1HNVja=w XNPBH5UpS^3e(3)pNcJ05aIXIbg!u$o delta 410 zcmZ{fODKd<7>1j3nfW`p=1?M?#gt2P`57h~q1d?3VoLm@N!TfJiLw|?Ohiq6i;vyd z3aMF~1!;DajhWb3Xq2_A?8rgcS-hL4p6`3#tzGX!(t959XGa5jj4llKK|bpR`%%DH zLBQL(NUBgugqj}9%fRZ3^P&Y!C685Xy+-{v3HVirNT2zhiCZabSiqyP24(q?YWubYa8Pm3QKIO zMGpn63)e5u1{}NarPT`Hew)=ul)|G9tG;GZInHvd#c?K^e$3|XSa9Blm5pwxKie!% F;R_GckS+iK diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 444e5c428e040ede873ab6d916e465d11caaa77c..299562e392297ee00de29513bedcf24e6a013bb1 100644 GIT binary patch delta 195 zcmbRKo%P5M)(tlWxO4N1QiDq>b29VNCl<2$WC=^5F6q1XJ z6_Rrji;Gi>6*BV_N-|Ov(o^$NixNvxQxq~va&wxG3v53wz_>+(HM$}~A$EF$D&tWE zQ*C;I8si=-b)5`7BpcP#H1f4=GwqcWN)n5+b#pR{OLQ|!Qgd~a^K%PwQcF^mtdx{A Wb%1Krr|YOQT0+d*o~6#H8v+0wM?`7> delta 62 zcmX@|gLV3M)(tlWntcSf`v@{F5@D^ViKtPSzE_P=ZMviy<9r1F(e#_@jFu4oc5w|x G-4FotJr*4R diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index bfb6b8dff304eacbaf28b4aed0f8529831e137c8..863a79043c30afc5569300dde7f0a661e7f26104 100644 GIT binary patch delta 2207 zcmb7FOKenC7|uVP(wU*OjX+~tEKmwHnTwsiAK{U6&fK{jN;^(xI&C3h+B!_9^X_z* zhd_cX#0U7e4TqIUsfi0?&`k7h1Wizbq!DAH3uA(~(uE6L8Bz2<_s+CMS8itV-~Vy` z|NFlGoR@EHdU$Ko`_&bjV~K^JZ!sSY$3sPH#n9q`DMF?tM%ZMWNwb8^N-|;3G08{B zxYX+;EWo5;LPn$sB9BFwl%Ry9s7Q#@qiVNMY|EKB2ZQ}w9{i58dhk5fBWFbWiXTTM z?o;|Go`|eZR0?~<8cxVK(nLEI^GzdILz7AMm(x319*OeciOL)$V#?vNM{PUfFd1Dq zaES4F{S=QBb_o#6ZRlmE3GrhunC%khxE<=XGq-EY33()9k!Fe)&i+;dX^w$U7%7YMMfjVsRuVJYI9C0i{=qL zPYE%5(f;?lrfsLFl){gb27fLcD1Ofdjr`j%H1ie{csu3>oC2*0OdLNcQ1o^8I}w<% zw2%);vRsEA;7tw*f_-8Bwh8uF)~q`wXj``)n&9x>vJWeJ1U5Pbeg7^qQvreX#7`?= zY~5-!L(975G{a%#k)p(NR220JfybRa*f3gCLeya@+Q)%BVy8m%Ki%Ip!xPf~%Gg>7 zN9x**suTJerfF7-Rl=ajnxhES$c)3qQ(oA~?^MADTRJGpwgh^&cF_XYE3K%8S>m3_ zE9$ww8nkE){0^1{w}e8O4r|dm_^i^}r4uR#dbNRi=(4Q2IlA}rIU>65))^z9@?$l-3@k7P{kn>S_h38S}EBWh7#)9 z@HL3HgSgPdYAK_o=%`bm$|lp?y9ZjW^G;p0t`tAJ2WG0~oYE9wetrghd~+)tx0d1q zdi*x+d@DQ)wH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UgzmIv-2B9U#ziiO6B=y;0?m@~a!gg{P+HzB zg>Nb{9P2ip-bU-111=Ohk@sQd8=5n-4R=>tZ@J(PaKwF7YJ*|f%VntD%o1SV8#dvn4nJ8i>w>1M{&}|tY3D( zM@5b%jx38%vpg!`fGpVwKf0O}Dft+!*6%yvgniM@Lc0sFtb@G8oBB*SZAHx5BrPCS_JWo zos^K}2jEr(zHB%va+9gvDtQVn+RN~j!Xwx?cH39OP-l0fh&A6(y@Uw#*cYN@KPB*u?f!F zygjW}&1=wXug07cf|&Z{W~$hiw5DE% +
  • test
  • +
  • testing complete
  • + diff --git a/test/functional/makehtml/cases/features/moreStyling/tasklists-with-styling.md b/test/functional/makehtml/cases/features/moreStyling/tasklists-with-styling.md new file mode 100644 index 0000000..d13904a --- /dev/null +++ b/test/functional/makehtml/cases/features/moreStyling/tasklists-with-styling.md @@ -0,0 +1,2 @@ +- [ ] test +- [x] testing complete diff --git a/test/functional/makehtml/testsuite.features.js b/test/functional/makehtml/testsuite.features.js index cb0caa0..8cbdfc0 100644 --- a/test/functional/makehtml/testsuite.features.js +++ b/test/functional/makehtml/testsuite.features.js @@ -19,6 +19,7 @@ var bootstrap = require('./makehtml.bootstrap.js'), completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'), metadataSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/metadata/'), splitAdjacentBlockquotesSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/splitAdjacentBlockquotes/'), + moreStyling = bootstrap.getTestSuite('test/functional/makehtml/cases/features/moreStyling/'), http = require('http'), https = require('https'), expect = require('chai').expect; @@ -320,4 +321,16 @@ describe('makeHtml() features testsuite', function () { it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter)); } }); + + /** test moreStyling option **/ + describe('moreStyling option', function () { + var converter, + suite = moreStyling; + + for (var i = 0; i < suite.length; ++i) { + converter = new showdown.Converter({moreStyling: true, tasklists: true}); + it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter)); + } + }); + });