showdown.js 187 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092
  1. ;/*! showdown v 2.0.0-alpha1 - 23-12-2017 */
  2. (function(){
  3. /**
  4. * Created by Tivie on 13-07-2015.
  5. */
  6. function getDefaultOpts (simple) {
  7. 'use strict';
  8. var defaultOptions = {
  9. omitExtraWLInCodeBlocks: {
  10. defaultValue: false,
  11. describe: 'Omit the default extra whiteline added to code blocks',
  12. type: 'boolean'
  13. },
  14. noHeaderId: {
  15. defaultValue: false,
  16. describe: 'Turn on/off generated header id',
  17. type: 'boolean'
  18. },
  19. prefixHeaderId: {
  20. defaultValue: false,
  21. describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
  22. type: 'string'
  23. },
  24. rawPrefixHeaderId: {
  25. defaultValue: false,
  26. describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
  27. type: 'boolean'
  28. },
  29. ghCompatibleHeaderId: {
  30. defaultValue: false,
  31. describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
  32. type: 'boolean'
  33. },
  34. rawHeaderId: {
  35. defaultValue: false,
  36. describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
  37. type: 'boolean'
  38. },
  39. headerLevelStart: {
  40. defaultValue: false,
  41. describe: 'The header blocks level start',
  42. type: 'integer'
  43. },
  44. parseImgDimensions: {
  45. defaultValue: false,
  46. describe: 'Turn on/off image dimension parsing',
  47. type: 'boolean'
  48. },
  49. simplifiedAutoLink: {
  50. defaultValue: false,
  51. describe: 'Turn on/off GFM autolink style',
  52. type: 'boolean'
  53. },
  54. excludeTrailingPunctuationFromURLs: {
  55. defaultValue: false,
  56. describe: 'Excludes trailing punctuation from links generated with autoLinking',
  57. type: 'boolean'
  58. },
  59. literalMidWordUnderscores: {
  60. defaultValue: false,
  61. describe: 'Parse midword underscores as literal underscores',
  62. type: 'boolean'
  63. },
  64. literalMidWordAsterisks: {
  65. defaultValue: false,
  66. describe: 'Parse midword asterisks as literal asterisks',
  67. type: 'boolean'
  68. },
  69. strikethrough: {
  70. defaultValue: false,
  71. describe: 'Turn on/off strikethrough support',
  72. type: 'boolean'
  73. },
  74. tables: {
  75. defaultValue: false,
  76. describe: 'Turn on/off tables support',
  77. type: 'boolean'
  78. },
  79. tablesHeaderId: {
  80. defaultValue: false,
  81. describe: 'Add an id to table headers',
  82. type: 'boolean'
  83. },
  84. ghCodeBlocks: {
  85. defaultValue: true,
  86. describe: 'Turn on/off GFM fenced code blocks support',
  87. type: 'boolean'
  88. },
  89. tasklists: {
  90. defaultValue: false,
  91. describe: 'Turn on/off GFM tasklist support',
  92. type: 'boolean'
  93. },
  94. smoothLivePreview: {
  95. defaultValue: false,
  96. describe: 'Prevents weird effects in live previews due to incomplete input',
  97. type: 'boolean'
  98. },
  99. smartIndentationFix: {
  100. defaultValue: false,
  101. description: 'Tries to smartly fix indentation in es6 strings',
  102. type: 'boolean'
  103. },
  104. disableForced4SpacesIndentedSublists: {
  105. defaultValue: false,
  106. description: 'Disables the requirement of indenting nested sublists by 4 spaces',
  107. type: 'boolean'
  108. },
  109. simpleLineBreaks: {
  110. defaultValue: false,
  111. description: 'Parses simple line breaks as <br> (GFM Style)',
  112. type: 'boolean'
  113. },
  114. requireSpaceBeforeHeadingText: {
  115. defaultValue: false,
  116. description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
  117. type: 'boolean'
  118. },
  119. ghMentions: {
  120. defaultValue: false,
  121. description: 'Enables github @mentions',
  122. type: 'boolean'
  123. },
  124. ghMentionsLink: {
  125. defaultValue: 'https://github.com/{u}',
  126. description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
  127. type: 'string'
  128. },
  129. encodeEmails: {
  130. defaultValue: true,
  131. description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
  132. type: 'boolean'
  133. },
  134. openLinksInNewWindow: {
  135. defaultValue: false,
  136. description: 'Open all links in new windows',
  137. type: 'boolean'
  138. },
  139. backslashEscapesHTMLTags: {
  140. defaultValue: false,
  141. description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
  142. type: 'boolean'
  143. },
  144. emoji: {
  145. defaultValue: false,
  146. description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
  147. type: 'boolean'
  148. },
  149. underline: {
  150. defaultValue: false,
  151. description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
  152. type: 'boolean'
  153. },
  154. completeHTMLDocument: {
  155. defaultValue: false,
  156. description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
  157. type: 'boolean'
  158. },
  159. metadata: {
  160. defaultValue: false,
  161. description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
  162. type: 'boolean'
  163. },
  164. splitAdjacentBlockquotes: {
  165. defaultValue: false,
  166. description: 'Split adjacent blockquote blocks',
  167. type: 'boolean'
  168. }
  169. };
  170. if (simple === false) {
  171. return JSON.parse(JSON.stringify(defaultOptions));
  172. }
  173. var ret = {};
  174. for (var opt in defaultOptions) {
  175. if (defaultOptions.hasOwnProperty(opt)) {
  176. ret[opt] = defaultOptions[opt].defaultValue;
  177. }
  178. }
  179. return ret;
  180. }
  181. function allOptionsOn () {
  182. 'use strict';
  183. var options = getDefaultOpts(true),
  184. ret = {};
  185. for (var opt in options) {
  186. if (options.hasOwnProperty(opt)) {
  187. ret[opt] = true;
  188. }
  189. }
  190. return ret;
  191. }
  192. /**
  193. * Created by Tivie on 06-01-2015.
  194. */
  195. // Private properties
  196. var showdown = {},
  197. parsers = {},
  198. extensions = {},
  199. globalOptions = getDefaultOpts(true),
  200. setFlavor = 'vanilla',
  201. flavor = {
  202. github: {
  203. omitExtraWLInCodeBlocks: true,
  204. simplifiedAutoLink: true,
  205. excludeTrailingPunctuationFromURLs: true,
  206. literalMidWordUnderscores: true,
  207. strikethrough: true,
  208. tables: true,
  209. tablesHeaderId: true,
  210. ghCodeBlocks: true,
  211. tasklists: true,
  212. disableForced4SpacesIndentedSublists: true,
  213. simpleLineBreaks: true,
  214. requireSpaceBeforeHeadingText: true,
  215. ghCompatibleHeaderId: true,
  216. ghMentions: true,
  217. backslashEscapesHTMLTags: true,
  218. emoji: true,
  219. splitAdjacentBlockquotes: true
  220. },
  221. original: {
  222. noHeaderId: true,
  223. ghCodeBlocks: false
  224. },
  225. ghost: {
  226. omitExtraWLInCodeBlocks: true,
  227. parseImgDimensions: true,
  228. simplifiedAutoLink: true,
  229. excludeTrailingPunctuationFromURLs: true,
  230. literalMidWordUnderscores: true,
  231. strikethrough: true,
  232. tables: true,
  233. tablesHeaderId: true,
  234. ghCodeBlocks: true,
  235. tasklists: true,
  236. smoothLivePreview: true,
  237. simpleLineBreaks: true,
  238. requireSpaceBeforeHeadingText: true,
  239. ghMentions: false,
  240. encodeEmails: true
  241. },
  242. vanilla: getDefaultOpts(true),
  243. allOn: allOptionsOn()
  244. };
  245. /**
  246. * helper namespace
  247. * @type {{}}
  248. */
  249. showdown.helper = {};
  250. /**
  251. * TODO LEGACY SUPPORT CODE
  252. * @type {{}}
  253. */
  254. showdown.extensions = {};
  255. /**
  256. * Set a global option
  257. * @static
  258. * @param {string} key
  259. * @param {*} value
  260. * @returns {showdown}
  261. */
  262. showdown.setOption = function (key, value) {
  263. 'use strict';
  264. globalOptions[key] = value;
  265. return this;
  266. };
  267. /**
  268. * Get a global option
  269. * @static
  270. * @param {string} key
  271. * @returns {*}
  272. */
  273. showdown.getOption = function (key) {
  274. 'use strict';
  275. return globalOptions[key];
  276. };
  277. /**
  278. * Get the global options
  279. * @static
  280. * @returns {{}}
  281. */
  282. showdown.getOptions = function () {
  283. 'use strict';
  284. return globalOptions;
  285. };
  286. /**
  287. * Reset global options to the default values
  288. * @static
  289. */
  290. showdown.resetOptions = function () {
  291. 'use strict';
  292. globalOptions = getDefaultOpts(true);
  293. };
  294. /**
  295. * Set the flavor showdown should use as default
  296. * @param {string} name
  297. */
  298. showdown.setFlavor = function (name) {
  299. 'use strict';
  300. if (!flavor.hasOwnProperty(name)) {
  301. throw Error(name + ' flavor was not found');
  302. }
  303. showdown.resetOptions();
  304. var preset = flavor[name];
  305. setFlavor = name;
  306. for (var option in preset) {
  307. if (preset.hasOwnProperty(option)) {
  308. globalOptions[option] = preset[option];
  309. }
  310. }
  311. };
  312. /**
  313. * Get the currently set flavor
  314. * @returns {string}
  315. */
  316. showdown.getFlavor = function () {
  317. 'use strict';
  318. return setFlavor;
  319. };
  320. /**
  321. * Get the options of a specified flavor. Returns undefined if the flavor was not found
  322. * @param {string} name Name of the flavor
  323. * @returns {{}|undefined}
  324. */
  325. showdown.getFlavorOptions = function (name) {
  326. 'use strict';
  327. if (flavor.hasOwnProperty(name)) {
  328. return flavor[name];
  329. }
  330. };
  331. /**
  332. * Get the default options
  333. * @static
  334. * @param {boolean} [simple=true]
  335. * @returns {{}}
  336. */
  337. showdown.getDefaultOptions = function (simple) {
  338. 'use strict';
  339. return getDefaultOpts(simple);
  340. };
  341. /**
  342. * Get or set a subParser
  343. *
  344. * subParser(name) - Get a registered subParser
  345. * subParser(name, func) - Register a subParser
  346. * @static
  347. * @param {string} name
  348. * @param {function} [func]
  349. * @returns {*}
  350. */
  351. showdown.subParser = function (name, func) {
  352. 'use strict';
  353. if (showdown.helper.isString(name)) {
  354. if (typeof func !== 'undefined') {
  355. parsers[name] = func;
  356. } else {
  357. if (parsers.hasOwnProperty(name)) {
  358. return parsers[name];
  359. } else {
  360. throw Error('SubParser named ' + name + ' not registered!');
  361. }
  362. }
  363. }
  364. };
  365. /**
  366. * Gets or registers an extension
  367. * @static
  368. * @param {string} name
  369. * @param {object|function=} ext
  370. * @returns {*}
  371. */
  372. showdown.extension = function (name, ext) {
  373. 'use strict';
  374. if (!showdown.helper.isString(name)) {
  375. throw Error('Extension \'name\' must be a string');
  376. }
  377. name = showdown.helper.stdExtName(name);
  378. // Getter
  379. if (showdown.helper.isUndefined(ext)) {
  380. if (!extensions.hasOwnProperty(name)) {
  381. throw Error('Extension named ' + name + ' is not registered!');
  382. }
  383. return extensions[name];
  384. // Setter
  385. } else {
  386. // Expand extension if it's wrapped in a function
  387. if (typeof ext === 'function') {
  388. ext = ext();
  389. }
  390. // Ensure extension is an array
  391. if (!showdown.helper.isArray(ext)) {
  392. ext = [ext];
  393. }
  394. var validExtension = validate(ext, name);
  395. if (validExtension.valid) {
  396. extensions[name] = ext;
  397. } else {
  398. throw Error(validExtension.error);
  399. }
  400. }
  401. };
  402. /**
  403. * Gets all extensions registered
  404. * @returns {{}}
  405. */
  406. showdown.getAllExtensions = function () {
  407. 'use strict';
  408. return extensions;
  409. };
  410. /**
  411. * Remove an extension
  412. * @param {string} name
  413. */
  414. showdown.removeExtension = function (name) {
  415. 'use strict';
  416. delete extensions[name];
  417. };
  418. /**
  419. * Removes all extensions
  420. */
  421. showdown.resetExtensions = function () {
  422. 'use strict';
  423. extensions = {};
  424. };
  425. /**
  426. * Validate extension
  427. * @param {array} extension
  428. * @param {string} name
  429. * @returns {{valid: boolean, error: string}}
  430. */
  431. function validate (extension, name) {
  432. 'use strict';
  433. var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
  434. ret = {
  435. valid: true,
  436. error: ''
  437. };
  438. if (!showdown.helper.isArray(extension)) {
  439. extension = [extension];
  440. }
  441. for (var i = 0; i < extension.length; ++i) {
  442. var baseMsg = errMsg + ' sub-extension ' + i + ': ',
  443. ext = extension[i];
  444. if (typeof ext !== 'object') {
  445. ret.valid = false;
  446. ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
  447. return ret;
  448. }
  449. if (!showdown.helper.isString(ext.type)) {
  450. ret.valid = false;
  451. ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
  452. return ret;
  453. }
  454. var type = ext.type = ext.type.toLowerCase();
  455. // normalize extension type
  456. if (type === 'language') {
  457. type = ext.type = 'lang';
  458. }
  459. if (type === 'html') {
  460. type = ext.type = 'output';
  461. }
  462. if (type !== 'lang' && type !== 'output' && type !== 'listener') {
  463. ret.valid = false;
  464. ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
  465. return ret;
  466. }
  467. if (type === 'listener') {
  468. if (showdown.helper.isUndefined(ext.listeners)) {
  469. ret.valid = false;
  470. ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
  471. return ret;
  472. }
  473. } else {
  474. if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
  475. ret.valid = false;
  476. ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
  477. return ret;
  478. }
  479. }
  480. if (ext.listeners) {
  481. if (typeof ext.listeners !== 'object') {
  482. ret.valid = false;
  483. ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
  484. return ret;
  485. }
  486. for (var ln in ext.listeners) {
  487. if (ext.listeners.hasOwnProperty(ln)) {
  488. if (typeof ext.listeners[ln] !== 'function') {
  489. ret.valid = false;
  490. ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
  491. ' must be a function but ' + typeof ext.listeners[ln] + ' given';
  492. return ret;
  493. }
  494. }
  495. }
  496. }
  497. if (ext.filter) {
  498. if (typeof ext.filter !== 'function') {
  499. ret.valid = false;
  500. ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
  501. return ret;
  502. }
  503. } else if (ext.regex) {
  504. if (showdown.helper.isString(ext.regex)) {
  505. ext.regex = new RegExp(ext.regex, 'g');
  506. }
  507. if (!(ext.regex instanceof RegExp)) {
  508. ret.valid = false;
  509. ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
  510. return ret;
  511. }
  512. if (showdown.helper.isUndefined(ext.replace)) {
  513. ret.valid = false;
  514. ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
  515. return ret;
  516. }
  517. }
  518. }
  519. return ret;
  520. }
  521. /**
  522. * Validate extension
  523. * @param {object} ext
  524. * @returns {boolean}
  525. */
  526. showdown.validateExtension = function (ext) {
  527. 'use strict';
  528. var validateExtension = validate(ext, null);
  529. if (!validateExtension.valid) {
  530. console.warn(validateExtension.error);
  531. return false;
  532. }
  533. return true;
  534. };
  535. /**
  536. * showdownjs helper functions
  537. */
  538. if (!showdown.hasOwnProperty('helper')) {
  539. showdown.helper = {};
  540. }
  541. if (typeof this.document === 'undefined' && typeof this.window === 'undefined') {
  542. this.window = require('jsdom').jsdom('', {}).defaultView; // jshint ignore:line
  543. }
  544. showdown.helper.document = this.window.document;
  545. /**
  546. * Check if var is string
  547. * @static
  548. * @param {string} a
  549. * @returns {boolean}
  550. */
  551. showdown.helper.isString = function (a) {
  552. 'use strict';
  553. return (typeof a === 'string' || a instanceof String);
  554. };
  555. /**
  556. * Check if var is a function
  557. * @static
  558. * @param {*} a
  559. * @returns {boolean}
  560. */
  561. showdown.helper.isFunction = function (a) {
  562. 'use strict';
  563. var getType = {};
  564. return a && getType.toString.call(a) === '[object Function]';
  565. };
  566. /**
  567. * isArray helper function
  568. * @static
  569. * @param {*} a
  570. * @returns {boolean}
  571. */
  572. showdown.helper.isArray = function (a) {
  573. 'use strict';
  574. return Array.isArray(a);
  575. };
  576. /**
  577. * Check if value is undefined
  578. * @static
  579. * @param {*} value The value to check.
  580. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  581. */
  582. showdown.helper.isUndefined = function (value) {
  583. 'use strict';
  584. return typeof value === 'undefined';
  585. };
  586. /**
  587. * ForEach helper function
  588. * Iterates over Arrays and Objects (own properties only)
  589. * @static
  590. * @param {*} obj
  591. * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
  592. */
  593. showdown.helper.forEach = function (obj, callback) {
  594. 'use strict';
  595. // check if obj is defined
  596. if (showdown.helper.isUndefined(obj)) {
  597. throw new Error('obj param is required');
  598. }
  599. if (showdown.helper.isUndefined(callback)) {
  600. throw new Error('callback param is required');
  601. }
  602. if (!showdown.helper.isFunction(callback)) {
  603. throw new Error('callback param must be a function/closure');
  604. }
  605. if (typeof obj.forEach === 'function') {
  606. obj.forEach(callback);
  607. } else if (showdown.helper.isArray(obj)) {
  608. for (var i = 0; i < obj.length; i++) {
  609. callback(obj[i], i, obj);
  610. }
  611. } else if (typeof (obj) === 'object') {
  612. for (var prop in obj) {
  613. if (obj.hasOwnProperty(prop)) {
  614. callback(obj[prop], prop, obj);
  615. }
  616. }
  617. } else {
  618. throw new Error('obj does not seem to be an array or an iterable object');
  619. }
  620. };
  621. /**
  622. * Standardidize extension name
  623. * @static
  624. * @param {string} s extension name
  625. * @returns {string}
  626. */
  627. showdown.helper.stdExtName = function (s) {
  628. 'use strict';
  629. return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
  630. };
  631. function escapeCharactersCallback (wholeMatch, m1) {
  632. 'use strict';
  633. var charCodeToEscape = m1.charCodeAt(0);
  634. return '¨E' + charCodeToEscape + 'E';
  635. }
  636. /**
  637. * Callback used to escape characters when passing through String.replace
  638. * @static
  639. * @param {string} wholeMatch
  640. * @param {string} m1
  641. * @returns {string}
  642. */
  643. showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
  644. /**
  645. * Escape characters in a string
  646. * @static
  647. * @param {string} text
  648. * @param {string} charsToEscape
  649. * @param {boolean} afterBackslash
  650. * @returns {XML|string|void|*}
  651. */
  652. showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
  653. 'use strict';
  654. // First we have to escape the escape characters so that
  655. // we can build a character class out of them
  656. var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
  657. if (afterBackslash) {
  658. regexString = '\\\\' + regexString;
  659. }
  660. var regex = new RegExp(regexString, 'g');
  661. text = text.replace(regex, escapeCharactersCallback);
  662. return text;
  663. };
  664. var rgxFindMatchPos = function (str, left, right, flags) {
  665. 'use strict';
  666. var f = flags || '',
  667. g = f.indexOf('g') > -1,
  668. x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
  669. l = new RegExp(left, f.replace(/g/g, '')),
  670. pos = [],
  671. t, s, m, start, end;
  672. do {
  673. t = 0;
  674. while ((m = x.exec(str))) {
  675. if (l.test(m[0])) {
  676. if (!(t++)) {
  677. s = x.lastIndex;
  678. start = s - m[0].length;
  679. }
  680. } else if (t) {
  681. if (!--t) {
  682. end = m.index + m[0].length;
  683. var obj = {
  684. left: {start: start, end: s},
  685. match: {start: s, end: m.index},
  686. right: {start: m.index, end: end},
  687. wholeMatch: {start: start, end: end}
  688. };
  689. pos.push(obj);
  690. if (!g) {
  691. return pos;
  692. }
  693. }
  694. }
  695. }
  696. } while (t && (x.lastIndex = s));
  697. return pos;
  698. };
  699. /**
  700. * matchRecursiveRegExp
  701. *
  702. * (c) 2007 Steven Levithan <stevenlevithan.com>
  703. * MIT License
  704. *
  705. * Accepts a string to search, a left and right format delimiter
  706. * as regex patterns, and optional regex flags. Returns an array
  707. * of matches, allowing nested instances of left/right delimiters.
  708. * Use the "g" flag to return all matches, otherwise only the
  709. * first is returned. Be careful to ensure that the left and
  710. * right format delimiters produce mutually exclusive matches.
  711. * Backreferences are not supported within the right delimiter
  712. * due to how it is internally combined with the left delimiter.
  713. * When matching strings whose format delimiters are unbalanced
  714. * to the left or right, the output is intentionally as a
  715. * conventional regex library with recursion support would
  716. * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
  717. * "<" and ">" as the delimiters (both strings contain a single,
  718. * balanced instance of "<x>").
  719. *
  720. * examples:
  721. * matchRecursiveRegExp("test", "\\(", "\\)")
  722. * returns: []
  723. * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
  724. * returns: ["t<<e>><s>", ""]
  725. * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
  726. * returns: ["test"]
  727. */
  728. showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
  729. 'use strict';
  730. var matchPos = rgxFindMatchPos (str, left, right, flags),
  731. results = [];
  732. for (var i = 0; i < matchPos.length; ++i) {
  733. results.push([
  734. str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
  735. str.slice(matchPos[i].match.start, matchPos[i].match.end),
  736. str.slice(matchPos[i].left.start, matchPos[i].left.end),
  737. str.slice(matchPos[i].right.start, matchPos[i].right.end)
  738. ]);
  739. }
  740. return results;
  741. };
  742. /**
  743. *
  744. * @param {string} str
  745. * @param {string|function} replacement
  746. * @param {string} left
  747. * @param {string} right
  748. * @param {string} flags
  749. * @returns {string}
  750. */
  751. showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
  752. 'use strict';
  753. if (!showdown.helper.isFunction(replacement)) {
  754. var repStr = replacement;
  755. replacement = function () {
  756. return repStr;
  757. };
  758. }
  759. var matchPos = rgxFindMatchPos(str, left, right, flags),
  760. finalStr = str,
  761. lng = matchPos.length;
  762. if (lng > 0) {
  763. var bits = [];
  764. if (matchPos[0].wholeMatch.start !== 0) {
  765. bits.push(str.slice(0, matchPos[0].wholeMatch.start));
  766. }
  767. for (var i = 0; i < lng; ++i) {
  768. bits.push(
  769. replacement(
  770. str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
  771. str.slice(matchPos[i].match.start, matchPos[i].match.end),
  772. str.slice(matchPos[i].left.start, matchPos[i].left.end),
  773. str.slice(matchPos[i].right.start, matchPos[i].right.end)
  774. )
  775. );
  776. if (i < lng - 1) {
  777. bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
  778. }
  779. }
  780. if (matchPos[lng - 1].wholeMatch.end < str.length) {
  781. bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
  782. }
  783. finalStr = bits.join('');
  784. }
  785. return finalStr;
  786. };
  787. /**
  788. * Returns the index within the passed String object of the first occurrence of the specified regex,
  789. * starting the search at fromIndex. Returns -1 if the value is not found.
  790. *
  791. * @param {string} str string to search
  792. * @param {RegExp} regex Regular expression to search
  793. * @param {int} [fromIndex = 0] Index to start the search
  794. * @returns {Number}
  795. * @throws InvalidArgumentError
  796. */
  797. showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
  798. 'use strict';
  799. if (!showdown.helper.isString(str)) {
  800. throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
  801. }
  802. if (regex instanceof RegExp === false) {
  803. throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
  804. }
  805. var indexOf = str.substring(fromIndex || 0).search(regex);
  806. return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
  807. };
  808. /**
  809. * Splits the passed string object at the defined index, and returns an array composed of the two substrings
  810. * @param {string} str string to split
  811. * @param {int} index index to split string at
  812. * @returns {[string,string]}
  813. * @throws InvalidArgumentError
  814. */
  815. showdown.helper.splitAtIndex = function (str, index) {
  816. 'use strict';
  817. if (!showdown.helper.isString(str)) {
  818. throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
  819. }
  820. return [str.substring(0, index), str.substring(index)];
  821. };
  822. /**
  823. * Obfuscate an e-mail address through the use of Character Entities,
  824. * transforming ASCII characters into their equivalent decimal or hex entities.
  825. *
  826. * Since it has a random component, subsequent calls to this function produce different results
  827. *
  828. * @param {string} mail
  829. * @returns {string}
  830. */
  831. showdown.helper.encodeEmailAddress = function (mail) {
  832. 'use strict';
  833. var encode = [
  834. function (ch) {
  835. return '&#' + ch.charCodeAt(0) + ';';
  836. },
  837. function (ch) {
  838. return '&#x' + ch.charCodeAt(0).toString(16) + ';';
  839. },
  840. function (ch) {
  841. return ch;
  842. }
  843. ];
  844. mail = mail.replace(/./g, function (ch) {
  845. if (ch === '@') {
  846. // this *must* be encoded. I insist.
  847. ch = encode[Math.floor(Math.random() * 2)](ch);
  848. } else {
  849. var r = Math.random();
  850. // roughly 10% raw, 45% hex, 45% dec
  851. ch = (
  852. r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
  853. );
  854. }
  855. return ch;
  856. });
  857. return mail;
  858. };
  859. /**
  860. *
  861. * @param str
  862. * @param targetLength
  863. * @param padString
  864. * @returns {string}
  865. */
  866. showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
  867. 'use strict';
  868. /*jshint bitwise: false*/
  869. // eslint-disable-next-line space-infix-ops
  870. targetLength = targetLength>>0; //floor if number or convert non-number to 0;
  871. /*jshint bitwise: true*/
  872. padString = String(padString || ' ');
  873. if (str.length > targetLength) {
  874. return String(str);
  875. } else {
  876. targetLength = targetLength - str.length;
  877. if (targetLength > padString.length) {
  878. padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
  879. }
  880. return String(str) + padString.slice(0,targetLength);
  881. }
  882. };
  883. /**
  884. * Unescape HTML entities
  885. * @param txt
  886. * @returns {string}
  887. */
  888. showdown.helper.unescapeHTMLEntities = function (txt) {
  889. 'use strict';
  890. return txt
  891. .replace(/&quot;/g, '"')
  892. .replace(/&lt;/g, '<')
  893. .replace(/&gt;/g, '>')
  894. .replace(/&amp;/g, '&');
  895. };
  896. /**
  897. * POLYFILLS
  898. */
  899. // use this instead of builtin is undefined for IE8 compatibility
  900. if (typeof(console) === 'undefined') {
  901. console = {
  902. warn: function (msg) {
  903. 'use strict';
  904. alert(msg);
  905. },
  906. log: function (msg) {
  907. 'use strict';
  908. alert(msg);
  909. },
  910. error: function (msg) {
  911. 'use strict';
  912. throw msg;
  913. }
  914. };
  915. }
  916. /**
  917. * Common regexes.
  918. * We declare some common regexes to improve performance
  919. */
  920. showdown.helper.regexes = {
  921. asteriskDashAndColon: /([*_:~])/g
  922. };
  923. /**
  924. * EMOJIS LIST
  925. */
  926. showdown.helper.emojis = {
  927. '+1':'\ud83d\udc4d',
  928. '-1':'\ud83d\udc4e',
  929. '100':'\ud83d\udcaf',
  930. '1234':'\ud83d\udd22',
  931. '1st_place_medal':'\ud83e\udd47',
  932. '2nd_place_medal':'\ud83e\udd48',
  933. '3rd_place_medal':'\ud83e\udd49',
  934. '8ball':'\ud83c\udfb1',
  935. 'a':'\ud83c\udd70\ufe0f',
  936. 'ab':'\ud83c\udd8e',
  937. 'abc':'\ud83d\udd24',
  938. 'abcd':'\ud83d\udd21',
  939. 'accept':'\ud83c\ude51',
  940. 'aerial_tramway':'\ud83d\udea1',
  941. 'airplane':'\u2708\ufe0f',
  942. 'alarm_clock':'\u23f0',
  943. 'alembic':'\u2697\ufe0f',
  944. 'alien':'\ud83d\udc7d',
  945. 'ambulance':'\ud83d\ude91',
  946. 'amphora':'\ud83c\udffa',
  947. 'anchor':'\u2693\ufe0f',
  948. 'angel':'\ud83d\udc7c',
  949. 'anger':'\ud83d\udca2',
  950. 'angry':'\ud83d\ude20',
  951. 'anguished':'\ud83d\ude27',
  952. 'ant':'\ud83d\udc1c',
  953. 'apple':'\ud83c\udf4e',
  954. 'aquarius':'\u2652\ufe0f',
  955. 'aries':'\u2648\ufe0f',
  956. 'arrow_backward':'\u25c0\ufe0f',
  957. 'arrow_double_down':'\u23ec',
  958. 'arrow_double_up':'\u23eb',
  959. 'arrow_down':'\u2b07\ufe0f',
  960. 'arrow_down_small':'\ud83d\udd3d',
  961. 'arrow_forward':'\u25b6\ufe0f',
  962. 'arrow_heading_down':'\u2935\ufe0f',
  963. 'arrow_heading_up':'\u2934\ufe0f',
  964. 'arrow_left':'\u2b05\ufe0f',
  965. 'arrow_lower_left':'\u2199\ufe0f',
  966. 'arrow_lower_right':'\u2198\ufe0f',
  967. 'arrow_right':'\u27a1\ufe0f',
  968. 'arrow_right_hook':'\u21aa\ufe0f',
  969. 'arrow_up':'\u2b06\ufe0f',
  970. 'arrow_up_down':'\u2195\ufe0f',
  971. 'arrow_up_small':'\ud83d\udd3c',
  972. 'arrow_upper_left':'\u2196\ufe0f',
  973. 'arrow_upper_right':'\u2197\ufe0f',
  974. 'arrows_clockwise':'\ud83d\udd03',
  975. 'arrows_counterclockwise':'\ud83d\udd04',
  976. 'art':'\ud83c\udfa8',
  977. 'articulated_lorry':'\ud83d\ude9b',
  978. 'artificial_satellite':'\ud83d\udef0',
  979. 'astonished':'\ud83d\ude32',
  980. 'athletic_shoe':'\ud83d\udc5f',
  981. 'atm':'\ud83c\udfe7',
  982. 'atom_symbol':'\u269b\ufe0f',
  983. 'avocado':'\ud83e\udd51',
  984. 'b':'\ud83c\udd71\ufe0f',
  985. 'baby':'\ud83d\udc76',
  986. 'baby_bottle':'\ud83c\udf7c',
  987. 'baby_chick':'\ud83d\udc24',
  988. 'baby_symbol':'\ud83d\udebc',
  989. 'back':'\ud83d\udd19',
  990. 'bacon':'\ud83e\udd53',
  991. 'badminton':'\ud83c\udff8',
  992. 'baggage_claim':'\ud83d\udec4',
  993. 'baguette_bread':'\ud83e\udd56',
  994. 'balance_scale':'\u2696\ufe0f',
  995. 'balloon':'\ud83c\udf88',
  996. 'ballot_box':'\ud83d\uddf3',
  997. 'ballot_box_with_check':'\u2611\ufe0f',
  998. 'bamboo':'\ud83c\udf8d',
  999. 'banana':'\ud83c\udf4c',
  1000. 'bangbang':'\u203c\ufe0f',
  1001. 'bank':'\ud83c\udfe6',
  1002. 'bar_chart':'\ud83d\udcca',
  1003. 'barber':'\ud83d\udc88',
  1004. 'baseball':'\u26be\ufe0f',
  1005. 'basketball':'\ud83c\udfc0',
  1006. 'basketball_man':'\u26f9\ufe0f',
  1007. 'basketball_woman':'\u26f9\ufe0f&zwj;\u2640\ufe0f',
  1008. 'bat':'\ud83e\udd87',
  1009. 'bath':'\ud83d\udec0',
  1010. 'bathtub':'\ud83d\udec1',
  1011. 'battery':'\ud83d\udd0b',
  1012. 'beach_umbrella':'\ud83c\udfd6',
  1013. 'bear':'\ud83d\udc3b',
  1014. 'bed':'\ud83d\udecf',
  1015. 'bee':'\ud83d\udc1d',
  1016. 'beer':'\ud83c\udf7a',
  1017. 'beers':'\ud83c\udf7b',
  1018. 'beetle':'\ud83d\udc1e',
  1019. 'beginner':'\ud83d\udd30',
  1020. 'bell':'\ud83d\udd14',
  1021. 'bellhop_bell':'\ud83d\udece',
  1022. 'bento':'\ud83c\udf71',
  1023. 'biking_man':'\ud83d\udeb4',
  1024. 'bike':'\ud83d\udeb2',
  1025. 'biking_woman':'\ud83d\udeb4&zwj;\u2640\ufe0f',
  1026. 'bikini':'\ud83d\udc59',
  1027. 'biohazard':'\u2623\ufe0f',
  1028. 'bird':'\ud83d\udc26',
  1029. 'birthday':'\ud83c\udf82',
  1030. 'black_circle':'\u26ab\ufe0f',
  1031. 'black_flag':'\ud83c\udff4',
  1032. 'black_heart':'\ud83d\udda4',
  1033. 'black_joker':'\ud83c\udccf',
  1034. 'black_large_square':'\u2b1b\ufe0f',
  1035. 'black_medium_small_square':'\u25fe\ufe0f',
  1036. 'black_medium_square':'\u25fc\ufe0f',
  1037. 'black_nib':'\u2712\ufe0f',
  1038. 'black_small_square':'\u25aa\ufe0f',
  1039. 'black_square_button':'\ud83d\udd32',
  1040. 'blonde_man':'\ud83d\udc71',
  1041. 'blonde_woman':'\ud83d\udc71&zwj;\u2640\ufe0f',
  1042. 'blossom':'\ud83c\udf3c',
  1043. 'blowfish':'\ud83d\udc21',
  1044. 'blue_book':'\ud83d\udcd8',
  1045. 'blue_car':'\ud83d\ude99',
  1046. 'blue_heart':'\ud83d\udc99',
  1047. 'blush':'\ud83d\ude0a',
  1048. 'boar':'\ud83d\udc17',
  1049. 'boat':'\u26f5\ufe0f',
  1050. 'bomb':'\ud83d\udca3',
  1051. 'book':'\ud83d\udcd6',
  1052. 'bookmark':'\ud83d\udd16',
  1053. 'bookmark_tabs':'\ud83d\udcd1',
  1054. 'books':'\ud83d\udcda',
  1055. 'boom':'\ud83d\udca5',
  1056. 'boot':'\ud83d\udc62',
  1057. 'bouquet':'\ud83d\udc90',
  1058. 'bowing_man':'\ud83d\ude47',
  1059. 'bow_and_arrow':'\ud83c\udff9',
  1060. 'bowing_woman':'\ud83d\ude47&zwj;\u2640\ufe0f',
  1061. 'bowling':'\ud83c\udfb3',
  1062. 'boxing_glove':'\ud83e\udd4a',
  1063. 'boy':'\ud83d\udc66',
  1064. 'bread':'\ud83c\udf5e',
  1065. 'bride_with_veil':'\ud83d\udc70',
  1066. 'bridge_at_night':'\ud83c\udf09',
  1067. 'briefcase':'\ud83d\udcbc',
  1068. 'broken_heart':'\ud83d\udc94',
  1069. 'bug':'\ud83d\udc1b',
  1070. 'building_construction':'\ud83c\udfd7',
  1071. 'bulb':'\ud83d\udca1',
  1072. 'bullettrain_front':'\ud83d\ude85',
  1073. 'bullettrain_side':'\ud83d\ude84',
  1074. 'burrito':'\ud83c\udf2f',
  1075. 'bus':'\ud83d\ude8c',
  1076. 'business_suit_levitating':'\ud83d\udd74',
  1077. 'busstop':'\ud83d\ude8f',
  1078. 'bust_in_silhouette':'\ud83d\udc64',
  1079. 'busts_in_silhouette':'\ud83d\udc65',
  1080. 'butterfly':'\ud83e\udd8b',
  1081. 'cactus':'\ud83c\udf35',
  1082. 'cake':'\ud83c\udf70',
  1083. 'calendar':'\ud83d\udcc6',
  1084. 'call_me_hand':'\ud83e\udd19',
  1085. 'calling':'\ud83d\udcf2',
  1086. 'camel':'\ud83d\udc2b',
  1087. 'camera':'\ud83d\udcf7',
  1088. 'camera_flash':'\ud83d\udcf8',
  1089. 'camping':'\ud83c\udfd5',
  1090. 'cancer':'\u264b\ufe0f',
  1091. 'candle':'\ud83d\udd6f',
  1092. 'candy':'\ud83c\udf6c',
  1093. 'canoe':'\ud83d\udef6',
  1094. 'capital_abcd':'\ud83d\udd20',
  1095. 'capricorn':'\u2651\ufe0f',
  1096. 'car':'\ud83d\ude97',
  1097. 'card_file_box':'\ud83d\uddc3',
  1098. 'card_index':'\ud83d\udcc7',
  1099. 'card_index_dividers':'\ud83d\uddc2',
  1100. 'carousel_horse':'\ud83c\udfa0',
  1101. 'carrot':'\ud83e\udd55',
  1102. 'cat':'\ud83d\udc31',
  1103. 'cat2':'\ud83d\udc08',
  1104. 'cd':'\ud83d\udcbf',
  1105. 'chains':'\u26d3',
  1106. 'champagne':'\ud83c\udf7e',
  1107. 'chart':'\ud83d\udcb9',
  1108. 'chart_with_downwards_trend':'\ud83d\udcc9',
  1109. 'chart_with_upwards_trend':'\ud83d\udcc8',
  1110. 'checkered_flag':'\ud83c\udfc1',
  1111. 'cheese':'\ud83e\uddc0',
  1112. 'cherries':'\ud83c\udf52',
  1113. 'cherry_blossom':'\ud83c\udf38',
  1114. 'chestnut':'\ud83c\udf30',
  1115. 'chicken':'\ud83d\udc14',
  1116. 'children_crossing':'\ud83d\udeb8',
  1117. 'chipmunk':'\ud83d\udc3f',
  1118. 'chocolate_bar':'\ud83c\udf6b',
  1119. 'christmas_tree':'\ud83c\udf84',
  1120. 'church':'\u26ea\ufe0f',
  1121. 'cinema':'\ud83c\udfa6',
  1122. 'circus_tent':'\ud83c\udfaa',
  1123. 'city_sunrise':'\ud83c\udf07',
  1124. 'city_sunset':'\ud83c\udf06',
  1125. 'cityscape':'\ud83c\udfd9',
  1126. 'cl':'\ud83c\udd91',
  1127. 'clamp':'\ud83d\udddc',
  1128. 'clap':'\ud83d\udc4f',
  1129. 'clapper':'\ud83c\udfac',
  1130. 'classical_building':'\ud83c\udfdb',
  1131. 'clinking_glasses':'\ud83e\udd42',
  1132. 'clipboard':'\ud83d\udccb',
  1133. 'clock1':'\ud83d\udd50',
  1134. 'clock10':'\ud83d\udd59',
  1135. 'clock1030':'\ud83d\udd65',
  1136. 'clock11':'\ud83d\udd5a',
  1137. 'clock1130':'\ud83d\udd66',
  1138. 'clock12':'\ud83d\udd5b',
  1139. 'clock1230':'\ud83d\udd67',
  1140. 'clock130':'\ud83d\udd5c',
  1141. 'clock2':'\ud83d\udd51',
  1142. 'clock230':'\ud83d\udd5d',
  1143. 'clock3':'\ud83d\udd52',
  1144. 'clock330':'\ud83d\udd5e',
  1145. 'clock4':'\ud83d\udd53',
  1146. 'clock430':'\ud83d\udd5f',
  1147. 'clock5':'\ud83d\udd54',
  1148. 'clock530':'\ud83d\udd60',
  1149. 'clock6':'\ud83d\udd55',
  1150. 'clock630':'\ud83d\udd61',
  1151. 'clock7':'\ud83d\udd56',
  1152. 'clock730':'\ud83d\udd62',
  1153. 'clock8':'\ud83d\udd57',
  1154. 'clock830':'\ud83d\udd63',
  1155. 'clock9':'\ud83d\udd58',
  1156. 'clock930':'\ud83d\udd64',
  1157. 'closed_book':'\ud83d\udcd5',
  1158. 'closed_lock_with_key':'\ud83d\udd10',
  1159. 'closed_umbrella':'\ud83c\udf02',
  1160. 'cloud':'\u2601\ufe0f',
  1161. 'cloud_with_lightning':'\ud83c\udf29',
  1162. 'cloud_with_lightning_and_rain':'\u26c8',
  1163. 'cloud_with_rain':'\ud83c\udf27',
  1164. 'cloud_with_snow':'\ud83c\udf28',
  1165. 'clown_face':'\ud83e\udd21',
  1166. 'clubs':'\u2663\ufe0f',
  1167. 'cocktail':'\ud83c\udf78',
  1168. 'coffee':'\u2615\ufe0f',
  1169. 'coffin':'\u26b0\ufe0f',
  1170. 'cold_sweat':'\ud83d\ude30',
  1171. 'comet':'\u2604\ufe0f',
  1172. 'computer':'\ud83d\udcbb',
  1173. 'computer_mouse':'\ud83d\uddb1',
  1174. 'confetti_ball':'\ud83c\udf8a',
  1175. 'confounded':'\ud83d\ude16',
  1176. 'confused':'\ud83d\ude15',
  1177. 'congratulations':'\u3297\ufe0f',
  1178. 'construction':'\ud83d\udea7',
  1179. 'construction_worker_man':'\ud83d\udc77',
  1180. 'construction_worker_woman':'\ud83d\udc77&zwj;\u2640\ufe0f',
  1181. 'control_knobs':'\ud83c\udf9b',
  1182. 'convenience_store':'\ud83c\udfea',
  1183. 'cookie':'\ud83c\udf6a',
  1184. 'cool':'\ud83c\udd92',
  1185. 'policeman':'\ud83d\udc6e',
  1186. 'copyright':'\u00a9\ufe0f',
  1187. 'corn':'\ud83c\udf3d',
  1188. 'couch_and_lamp':'\ud83d\udecb',
  1189. 'couple':'\ud83d\udc6b',
  1190. 'couple_with_heart_woman_man':'\ud83d\udc91',
  1191. 'couple_with_heart_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc68',
  1192. 'couple_with_heart_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc69',
  1193. 'couplekiss_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc68',
  1194. 'couplekiss_man_woman':'\ud83d\udc8f',
  1195. 'couplekiss_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc69',
  1196. 'cow':'\ud83d\udc2e',
  1197. 'cow2':'\ud83d\udc04',
  1198. 'cowboy_hat_face':'\ud83e\udd20',
  1199. 'crab':'\ud83e\udd80',
  1200. 'crayon':'\ud83d\udd8d',
  1201. 'credit_card':'\ud83d\udcb3',
  1202. 'crescent_moon':'\ud83c\udf19',
  1203. 'cricket':'\ud83c\udfcf',
  1204. 'crocodile':'\ud83d\udc0a',
  1205. 'croissant':'\ud83e\udd50',
  1206. 'crossed_fingers':'\ud83e\udd1e',
  1207. 'crossed_flags':'\ud83c\udf8c',
  1208. 'crossed_swords':'\u2694\ufe0f',
  1209. 'crown':'\ud83d\udc51',
  1210. 'cry':'\ud83d\ude22',
  1211. 'crying_cat_face':'\ud83d\ude3f',
  1212. 'crystal_ball':'\ud83d\udd2e',
  1213. 'cucumber':'\ud83e\udd52',
  1214. 'cupid':'\ud83d\udc98',
  1215. 'curly_loop':'\u27b0',
  1216. 'currency_exchange':'\ud83d\udcb1',
  1217. 'curry':'\ud83c\udf5b',
  1218. 'custard':'\ud83c\udf6e',
  1219. 'customs':'\ud83d\udec3',
  1220. 'cyclone':'\ud83c\udf00',
  1221. 'dagger':'\ud83d\udde1',
  1222. 'dancer':'\ud83d\udc83',
  1223. 'dancing_women':'\ud83d\udc6f',
  1224. 'dancing_men':'\ud83d\udc6f&zwj;\u2642\ufe0f',
  1225. 'dango':'\ud83c\udf61',
  1226. 'dark_sunglasses':'\ud83d\udd76',
  1227. 'dart':'\ud83c\udfaf',
  1228. 'dash':'\ud83d\udca8',
  1229. 'date':'\ud83d\udcc5',
  1230. 'deciduous_tree':'\ud83c\udf33',
  1231. 'deer':'\ud83e\udd8c',
  1232. 'department_store':'\ud83c\udfec',
  1233. 'derelict_house':'\ud83c\udfda',
  1234. 'desert':'\ud83c\udfdc',
  1235. 'desert_island':'\ud83c\udfdd',
  1236. 'desktop_computer':'\ud83d\udda5',
  1237. 'male_detective':'\ud83d\udd75\ufe0f',
  1238. 'diamond_shape_with_a_dot_inside':'\ud83d\udca0',
  1239. 'diamonds':'\u2666\ufe0f',
  1240. 'disappointed':'\ud83d\ude1e',
  1241. 'disappointed_relieved':'\ud83d\ude25',
  1242. 'dizzy':'\ud83d\udcab',
  1243. 'dizzy_face':'\ud83d\ude35',
  1244. 'do_not_litter':'\ud83d\udeaf',
  1245. 'dog':'\ud83d\udc36',
  1246. 'dog2':'\ud83d\udc15',
  1247. 'dollar':'\ud83d\udcb5',
  1248. 'dolls':'\ud83c\udf8e',
  1249. 'dolphin':'\ud83d\udc2c',
  1250. 'door':'\ud83d\udeaa',
  1251. 'doughnut':'\ud83c\udf69',
  1252. 'dove':'\ud83d\udd4a',
  1253. 'dragon':'\ud83d\udc09',
  1254. 'dragon_face':'\ud83d\udc32',
  1255. 'dress':'\ud83d\udc57',
  1256. 'dromedary_camel':'\ud83d\udc2a',
  1257. 'drooling_face':'\ud83e\udd24',
  1258. 'droplet':'\ud83d\udca7',
  1259. 'drum':'\ud83e\udd41',
  1260. 'duck':'\ud83e\udd86',
  1261. 'dvd':'\ud83d\udcc0',
  1262. 'e-mail':'\ud83d\udce7',
  1263. 'eagle':'\ud83e\udd85',
  1264. 'ear':'\ud83d\udc42',
  1265. 'ear_of_rice':'\ud83c\udf3e',
  1266. 'earth_africa':'\ud83c\udf0d',
  1267. 'earth_americas':'\ud83c\udf0e',
  1268. 'earth_asia':'\ud83c\udf0f',
  1269. 'egg':'\ud83e\udd5a',
  1270. 'eggplant':'\ud83c\udf46',
  1271. 'eight_pointed_black_star':'\u2734\ufe0f',
  1272. 'eight_spoked_asterisk':'\u2733\ufe0f',
  1273. 'electric_plug':'\ud83d\udd0c',
  1274. 'elephant':'\ud83d\udc18',
  1275. 'email':'\u2709\ufe0f',
  1276. 'end':'\ud83d\udd1a',
  1277. 'envelope_with_arrow':'\ud83d\udce9',
  1278. 'euro':'\ud83d\udcb6',
  1279. 'european_castle':'\ud83c\udff0',
  1280. 'european_post_office':'\ud83c\udfe4',
  1281. 'evergreen_tree':'\ud83c\udf32',
  1282. 'exclamation':'\u2757\ufe0f',
  1283. 'expressionless':'\ud83d\ude11',
  1284. 'eye':'\ud83d\udc41',
  1285. 'eye_speech_bubble':'\ud83d\udc41&zwj;\ud83d\udde8',
  1286. 'eyeglasses':'\ud83d\udc53',
  1287. 'eyes':'\ud83d\udc40',
  1288. 'face_with_head_bandage':'\ud83e\udd15',
  1289. 'face_with_thermometer':'\ud83e\udd12',
  1290. 'fist_oncoming':'\ud83d\udc4a',
  1291. 'factory':'\ud83c\udfed',
  1292. 'fallen_leaf':'\ud83c\udf42',
  1293. 'family_man_woman_boy':'\ud83d\udc6a',
  1294. 'family_man_boy':'\ud83d\udc68&zwj;\ud83d\udc66',
  1295. 'family_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1296. 'family_man_girl':'\ud83d\udc68&zwj;\ud83d\udc67',
  1297. 'family_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1298. 'family_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1299. 'family_man_man_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66',
  1300. 'family_man_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1301. 'family_man_man_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67',
  1302. 'family_man_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1303. 'family_man_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1304. 'family_man_woman_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1305. 'family_man_woman_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
  1306. 'family_man_woman_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1307. 'family_man_woman_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1308. 'family_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc66',
  1309. 'family_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1310. 'family_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc67',
  1311. 'family_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1312. 'family_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1313. 'family_woman_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66',
  1314. 'family_woman_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
  1315. 'family_woman_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
  1316. 'family_woman_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
  1317. 'family_woman_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
  1318. 'fast_forward':'\u23e9',
  1319. 'fax':'\ud83d\udce0',
  1320. 'fearful':'\ud83d\ude28',
  1321. 'feet':'\ud83d\udc3e',
  1322. 'female_detective':'\ud83d\udd75\ufe0f&zwj;\u2640\ufe0f',
  1323. 'ferris_wheel':'\ud83c\udfa1',
  1324. 'ferry':'\u26f4',
  1325. 'field_hockey':'\ud83c\udfd1',
  1326. 'file_cabinet':'\ud83d\uddc4',
  1327. 'file_folder':'\ud83d\udcc1',
  1328. 'film_projector':'\ud83d\udcfd',
  1329. 'film_strip':'\ud83c\udf9e',
  1330. 'fire':'\ud83d\udd25',
  1331. 'fire_engine':'\ud83d\ude92',
  1332. 'fireworks':'\ud83c\udf86',
  1333. 'first_quarter_moon':'\ud83c\udf13',
  1334. 'first_quarter_moon_with_face':'\ud83c\udf1b',
  1335. 'fish':'\ud83d\udc1f',
  1336. 'fish_cake':'\ud83c\udf65',
  1337. 'fishing_pole_and_fish':'\ud83c\udfa3',
  1338. 'fist_raised':'\u270a',
  1339. 'fist_left':'\ud83e\udd1b',
  1340. 'fist_right':'\ud83e\udd1c',
  1341. 'flags':'\ud83c\udf8f',
  1342. 'flashlight':'\ud83d\udd26',
  1343. 'fleur_de_lis':'\u269c\ufe0f',
  1344. 'flight_arrival':'\ud83d\udeec',
  1345. 'flight_departure':'\ud83d\udeeb',
  1346. 'floppy_disk':'\ud83d\udcbe',
  1347. 'flower_playing_cards':'\ud83c\udfb4',
  1348. 'flushed':'\ud83d\ude33',
  1349. 'fog':'\ud83c\udf2b',
  1350. 'foggy':'\ud83c\udf01',
  1351. 'football':'\ud83c\udfc8',
  1352. 'footprints':'\ud83d\udc63',
  1353. 'fork_and_knife':'\ud83c\udf74',
  1354. 'fountain':'\u26f2\ufe0f',
  1355. 'fountain_pen':'\ud83d\udd8b',
  1356. 'four_leaf_clover':'\ud83c\udf40',
  1357. 'fox_face':'\ud83e\udd8a',
  1358. 'framed_picture':'\ud83d\uddbc',
  1359. 'free':'\ud83c\udd93',
  1360. 'fried_egg':'\ud83c\udf73',
  1361. 'fried_shrimp':'\ud83c\udf64',
  1362. 'fries':'\ud83c\udf5f',
  1363. 'frog':'\ud83d\udc38',
  1364. 'frowning':'\ud83d\ude26',
  1365. 'frowning_face':'\u2639\ufe0f',
  1366. 'frowning_man':'\ud83d\ude4d&zwj;\u2642\ufe0f',
  1367. 'frowning_woman':'\ud83d\ude4d',
  1368. 'middle_finger':'\ud83d\udd95',
  1369. 'fuelpump':'\u26fd\ufe0f',
  1370. 'full_moon':'\ud83c\udf15',
  1371. 'full_moon_with_face':'\ud83c\udf1d',
  1372. 'funeral_urn':'\u26b1\ufe0f',
  1373. 'game_die':'\ud83c\udfb2',
  1374. 'gear':'\u2699\ufe0f',
  1375. 'gem':'\ud83d\udc8e',
  1376. 'gemini':'\u264a\ufe0f',
  1377. 'ghost':'\ud83d\udc7b',
  1378. 'gift':'\ud83c\udf81',
  1379. 'gift_heart':'\ud83d\udc9d',
  1380. 'girl':'\ud83d\udc67',
  1381. 'globe_with_meridians':'\ud83c\udf10',
  1382. 'goal_net':'\ud83e\udd45',
  1383. 'goat':'\ud83d\udc10',
  1384. 'golf':'\u26f3\ufe0f',
  1385. 'golfing_man':'\ud83c\udfcc\ufe0f',
  1386. 'golfing_woman':'\ud83c\udfcc\ufe0f&zwj;\u2640\ufe0f',
  1387. 'gorilla':'\ud83e\udd8d',
  1388. 'grapes':'\ud83c\udf47',
  1389. 'green_apple':'\ud83c\udf4f',
  1390. 'green_book':'\ud83d\udcd7',
  1391. 'green_heart':'\ud83d\udc9a',
  1392. 'green_salad':'\ud83e\udd57',
  1393. 'grey_exclamation':'\u2755',
  1394. 'grey_question':'\u2754',
  1395. 'grimacing':'\ud83d\ude2c',
  1396. 'grin':'\ud83d\ude01',
  1397. 'grinning':'\ud83d\ude00',
  1398. 'guardsman':'\ud83d\udc82',
  1399. 'guardswoman':'\ud83d\udc82&zwj;\u2640\ufe0f',
  1400. 'guitar':'\ud83c\udfb8',
  1401. 'gun':'\ud83d\udd2b',
  1402. 'haircut_woman':'\ud83d\udc87',
  1403. 'haircut_man':'\ud83d\udc87&zwj;\u2642\ufe0f',
  1404. 'hamburger':'\ud83c\udf54',
  1405. 'hammer':'\ud83d\udd28',
  1406. 'hammer_and_pick':'\u2692',
  1407. 'hammer_and_wrench':'\ud83d\udee0',
  1408. 'hamster':'\ud83d\udc39',
  1409. 'hand':'\u270b',
  1410. 'handbag':'\ud83d\udc5c',
  1411. 'handshake':'\ud83e\udd1d',
  1412. 'hankey':'\ud83d\udca9',
  1413. 'hatched_chick':'\ud83d\udc25',
  1414. 'hatching_chick':'\ud83d\udc23',
  1415. 'headphones':'\ud83c\udfa7',
  1416. 'hear_no_evil':'\ud83d\ude49',
  1417. 'heart':'\u2764\ufe0f',
  1418. 'heart_decoration':'\ud83d\udc9f',
  1419. 'heart_eyes':'\ud83d\ude0d',
  1420. 'heart_eyes_cat':'\ud83d\ude3b',
  1421. 'heartbeat':'\ud83d\udc93',
  1422. 'heartpulse':'\ud83d\udc97',
  1423. 'hearts':'\u2665\ufe0f',
  1424. 'heavy_check_mark':'\u2714\ufe0f',
  1425. 'heavy_division_sign':'\u2797',
  1426. 'heavy_dollar_sign':'\ud83d\udcb2',
  1427. 'heavy_heart_exclamation':'\u2763\ufe0f',
  1428. 'heavy_minus_sign':'\u2796',
  1429. 'heavy_multiplication_x':'\u2716\ufe0f',
  1430. 'heavy_plus_sign':'\u2795',
  1431. 'helicopter':'\ud83d\ude81',
  1432. 'herb':'\ud83c\udf3f',
  1433. 'hibiscus':'\ud83c\udf3a',
  1434. 'high_brightness':'\ud83d\udd06',
  1435. 'high_heel':'\ud83d\udc60',
  1436. 'hocho':'\ud83d\udd2a',
  1437. 'hole':'\ud83d\udd73',
  1438. 'honey_pot':'\ud83c\udf6f',
  1439. 'horse':'\ud83d\udc34',
  1440. 'horse_racing':'\ud83c\udfc7',
  1441. 'hospital':'\ud83c\udfe5',
  1442. 'hot_pepper':'\ud83c\udf36',
  1443. 'hotdog':'\ud83c\udf2d',
  1444. 'hotel':'\ud83c\udfe8',
  1445. 'hotsprings':'\u2668\ufe0f',
  1446. 'hourglass':'\u231b\ufe0f',
  1447. 'hourglass_flowing_sand':'\u23f3',
  1448. 'house':'\ud83c\udfe0',
  1449. 'house_with_garden':'\ud83c\udfe1',
  1450. 'houses':'\ud83c\udfd8',
  1451. 'hugs':'\ud83e\udd17',
  1452. 'hushed':'\ud83d\ude2f',
  1453. 'ice_cream':'\ud83c\udf68',
  1454. 'ice_hockey':'\ud83c\udfd2',
  1455. 'ice_skate':'\u26f8',
  1456. 'icecream':'\ud83c\udf66',
  1457. 'id':'\ud83c\udd94',
  1458. 'ideograph_advantage':'\ud83c\ude50',
  1459. 'imp':'\ud83d\udc7f',
  1460. 'inbox_tray':'\ud83d\udce5',
  1461. 'incoming_envelope':'\ud83d\udce8',
  1462. 'tipping_hand_woman':'\ud83d\udc81',
  1463. 'information_source':'\u2139\ufe0f',
  1464. 'innocent':'\ud83d\ude07',
  1465. 'interrobang':'\u2049\ufe0f',
  1466. 'iphone':'\ud83d\udcf1',
  1467. 'izakaya_lantern':'\ud83c\udfee',
  1468. 'jack_o_lantern':'\ud83c\udf83',
  1469. 'japan':'\ud83d\uddfe',
  1470. 'japanese_castle':'\ud83c\udfef',
  1471. 'japanese_goblin':'\ud83d\udc7a',
  1472. 'japanese_ogre':'\ud83d\udc79',
  1473. 'jeans':'\ud83d\udc56',
  1474. 'joy':'\ud83d\ude02',
  1475. 'joy_cat':'\ud83d\ude39',
  1476. 'joystick':'\ud83d\udd79',
  1477. 'kaaba':'\ud83d\udd4b',
  1478. 'key':'\ud83d\udd11',
  1479. 'keyboard':'\u2328\ufe0f',
  1480. 'keycap_ten':'\ud83d\udd1f',
  1481. 'kick_scooter':'\ud83d\udef4',
  1482. 'kimono':'\ud83d\udc58',
  1483. 'kiss':'\ud83d\udc8b',
  1484. 'kissing':'\ud83d\ude17',
  1485. 'kissing_cat':'\ud83d\ude3d',
  1486. 'kissing_closed_eyes':'\ud83d\ude1a',
  1487. 'kissing_heart':'\ud83d\ude18',
  1488. 'kissing_smiling_eyes':'\ud83d\ude19',
  1489. 'kiwi_fruit':'\ud83e\udd5d',
  1490. 'koala':'\ud83d\udc28',
  1491. 'koko':'\ud83c\ude01',
  1492. 'label':'\ud83c\udff7',
  1493. 'large_blue_circle':'\ud83d\udd35',
  1494. 'large_blue_diamond':'\ud83d\udd37',
  1495. 'large_orange_diamond':'\ud83d\udd36',
  1496. 'last_quarter_moon':'\ud83c\udf17',
  1497. 'last_quarter_moon_with_face':'\ud83c\udf1c',
  1498. 'latin_cross':'\u271d\ufe0f',
  1499. 'laughing':'\ud83d\ude06',
  1500. 'leaves':'\ud83c\udf43',
  1501. 'ledger':'\ud83d\udcd2',
  1502. 'left_luggage':'\ud83d\udec5',
  1503. 'left_right_arrow':'\u2194\ufe0f',
  1504. 'leftwards_arrow_with_hook':'\u21a9\ufe0f',
  1505. 'lemon':'\ud83c\udf4b',
  1506. 'leo':'\u264c\ufe0f',
  1507. 'leopard':'\ud83d\udc06',
  1508. 'level_slider':'\ud83c\udf9a',
  1509. 'libra':'\u264e\ufe0f',
  1510. 'light_rail':'\ud83d\ude88',
  1511. 'link':'\ud83d\udd17',
  1512. 'lion':'\ud83e\udd81',
  1513. 'lips':'\ud83d\udc44',
  1514. 'lipstick':'\ud83d\udc84',
  1515. 'lizard':'\ud83e\udd8e',
  1516. 'lock':'\ud83d\udd12',
  1517. 'lock_with_ink_pen':'\ud83d\udd0f',
  1518. 'lollipop':'\ud83c\udf6d',
  1519. 'loop':'\u27bf',
  1520. 'loud_sound':'\ud83d\udd0a',
  1521. 'loudspeaker':'\ud83d\udce2',
  1522. 'love_hotel':'\ud83c\udfe9',
  1523. 'love_letter':'\ud83d\udc8c',
  1524. 'low_brightness':'\ud83d\udd05',
  1525. 'lying_face':'\ud83e\udd25',
  1526. 'm':'\u24c2\ufe0f',
  1527. 'mag':'\ud83d\udd0d',
  1528. 'mag_right':'\ud83d\udd0e',
  1529. 'mahjong':'\ud83c\udc04\ufe0f',
  1530. 'mailbox':'\ud83d\udceb',
  1531. 'mailbox_closed':'\ud83d\udcea',
  1532. 'mailbox_with_mail':'\ud83d\udcec',
  1533. 'mailbox_with_no_mail':'\ud83d\udced',
  1534. 'man':'\ud83d\udc68',
  1535. 'man_artist':'\ud83d\udc68&zwj;\ud83c\udfa8',
  1536. 'man_astronaut':'\ud83d\udc68&zwj;\ud83d\ude80',
  1537. 'man_cartwheeling':'\ud83e\udd38&zwj;\u2642\ufe0f',
  1538. 'man_cook':'\ud83d\udc68&zwj;\ud83c\udf73',
  1539. 'man_dancing':'\ud83d\udd7a',
  1540. 'man_facepalming':'\ud83e\udd26&zwj;\u2642\ufe0f',
  1541. 'man_factory_worker':'\ud83d\udc68&zwj;\ud83c\udfed',
  1542. 'man_farmer':'\ud83d\udc68&zwj;\ud83c\udf3e',
  1543. 'man_firefighter':'\ud83d\udc68&zwj;\ud83d\ude92',
  1544. 'man_health_worker':'\ud83d\udc68&zwj;\u2695\ufe0f',
  1545. 'man_in_tuxedo':'\ud83e\udd35',
  1546. 'man_judge':'\ud83d\udc68&zwj;\u2696\ufe0f',
  1547. 'man_juggling':'\ud83e\udd39&zwj;\u2642\ufe0f',
  1548. 'man_mechanic':'\ud83d\udc68&zwj;\ud83d\udd27',
  1549. 'man_office_worker':'\ud83d\udc68&zwj;\ud83d\udcbc',
  1550. 'man_pilot':'\ud83d\udc68&zwj;\u2708\ufe0f',
  1551. 'man_playing_handball':'\ud83e\udd3e&zwj;\u2642\ufe0f',
  1552. 'man_playing_water_polo':'\ud83e\udd3d&zwj;\u2642\ufe0f',
  1553. 'man_scientist':'\ud83d\udc68&zwj;\ud83d\udd2c',
  1554. 'man_shrugging':'\ud83e\udd37&zwj;\u2642\ufe0f',
  1555. 'man_singer':'\ud83d\udc68&zwj;\ud83c\udfa4',
  1556. 'man_student':'\ud83d\udc68&zwj;\ud83c\udf93',
  1557. 'man_teacher':'\ud83d\udc68&zwj;\ud83c\udfeb',
  1558. 'man_technologist':'\ud83d\udc68&zwj;\ud83d\udcbb',
  1559. 'man_with_gua_pi_mao':'\ud83d\udc72',
  1560. 'man_with_turban':'\ud83d\udc73',
  1561. 'tangerine':'\ud83c\udf4a',
  1562. 'mans_shoe':'\ud83d\udc5e',
  1563. 'mantelpiece_clock':'\ud83d\udd70',
  1564. 'maple_leaf':'\ud83c\udf41',
  1565. 'martial_arts_uniform':'\ud83e\udd4b',
  1566. 'mask':'\ud83d\ude37',
  1567. 'massage_woman':'\ud83d\udc86',
  1568. 'massage_man':'\ud83d\udc86&zwj;\u2642\ufe0f',
  1569. 'meat_on_bone':'\ud83c\udf56',
  1570. 'medal_military':'\ud83c\udf96',
  1571. 'medal_sports':'\ud83c\udfc5',
  1572. 'mega':'\ud83d\udce3',
  1573. 'melon':'\ud83c\udf48',
  1574. 'memo':'\ud83d\udcdd',
  1575. 'men_wrestling':'\ud83e\udd3c&zwj;\u2642\ufe0f',
  1576. 'menorah':'\ud83d\udd4e',
  1577. 'mens':'\ud83d\udeb9',
  1578. 'metal':'\ud83e\udd18',
  1579. 'metro':'\ud83d\ude87',
  1580. 'microphone':'\ud83c\udfa4',
  1581. 'microscope':'\ud83d\udd2c',
  1582. 'milk_glass':'\ud83e\udd5b',
  1583. 'milky_way':'\ud83c\udf0c',
  1584. 'minibus':'\ud83d\ude90',
  1585. 'minidisc':'\ud83d\udcbd',
  1586. 'mobile_phone_off':'\ud83d\udcf4',
  1587. 'money_mouth_face':'\ud83e\udd11',
  1588. 'money_with_wings':'\ud83d\udcb8',
  1589. 'moneybag':'\ud83d\udcb0',
  1590. 'monkey':'\ud83d\udc12',
  1591. 'monkey_face':'\ud83d\udc35',
  1592. 'monorail':'\ud83d\ude9d',
  1593. 'moon':'\ud83c\udf14',
  1594. 'mortar_board':'\ud83c\udf93',
  1595. 'mosque':'\ud83d\udd4c',
  1596. 'motor_boat':'\ud83d\udee5',
  1597. 'motor_scooter':'\ud83d\udef5',
  1598. 'motorcycle':'\ud83c\udfcd',
  1599. 'motorway':'\ud83d\udee3',
  1600. 'mount_fuji':'\ud83d\uddfb',
  1601. 'mountain':'\u26f0',
  1602. 'mountain_biking_man':'\ud83d\udeb5',
  1603. 'mountain_biking_woman':'\ud83d\udeb5&zwj;\u2640\ufe0f',
  1604. 'mountain_cableway':'\ud83d\udea0',
  1605. 'mountain_railway':'\ud83d\ude9e',
  1606. 'mountain_snow':'\ud83c\udfd4',
  1607. 'mouse':'\ud83d\udc2d',
  1608. 'mouse2':'\ud83d\udc01',
  1609. 'movie_camera':'\ud83c\udfa5',
  1610. 'moyai':'\ud83d\uddff',
  1611. 'mrs_claus':'\ud83e\udd36',
  1612. 'muscle':'\ud83d\udcaa',
  1613. 'mushroom':'\ud83c\udf44',
  1614. 'musical_keyboard':'\ud83c\udfb9',
  1615. 'musical_note':'\ud83c\udfb5',
  1616. 'musical_score':'\ud83c\udfbc',
  1617. 'mute':'\ud83d\udd07',
  1618. 'nail_care':'\ud83d\udc85',
  1619. 'name_badge':'\ud83d\udcdb',
  1620. 'national_park':'\ud83c\udfde',
  1621. 'nauseated_face':'\ud83e\udd22',
  1622. 'necktie':'\ud83d\udc54',
  1623. 'negative_squared_cross_mark':'\u274e',
  1624. 'nerd_face':'\ud83e\udd13',
  1625. 'neutral_face':'\ud83d\ude10',
  1626. 'new':'\ud83c\udd95',
  1627. 'new_moon':'\ud83c\udf11',
  1628. 'new_moon_with_face':'\ud83c\udf1a',
  1629. 'newspaper':'\ud83d\udcf0',
  1630. 'newspaper_roll':'\ud83d\uddde',
  1631. 'next_track_button':'\u23ed',
  1632. 'ng':'\ud83c\udd96',
  1633. 'no_good_man':'\ud83d\ude45&zwj;\u2642\ufe0f',
  1634. 'no_good_woman':'\ud83d\ude45',
  1635. 'night_with_stars':'\ud83c\udf03',
  1636. 'no_bell':'\ud83d\udd15',
  1637. 'no_bicycles':'\ud83d\udeb3',
  1638. 'no_entry':'\u26d4\ufe0f',
  1639. 'no_entry_sign':'\ud83d\udeab',
  1640. 'no_mobile_phones':'\ud83d\udcf5',
  1641. 'no_mouth':'\ud83d\ude36',
  1642. 'no_pedestrians':'\ud83d\udeb7',
  1643. 'no_smoking':'\ud83d\udead',
  1644. 'non-potable_water':'\ud83d\udeb1',
  1645. 'nose':'\ud83d\udc43',
  1646. 'notebook':'\ud83d\udcd3',
  1647. 'notebook_with_decorative_cover':'\ud83d\udcd4',
  1648. 'notes':'\ud83c\udfb6',
  1649. 'nut_and_bolt':'\ud83d\udd29',
  1650. 'o':'\u2b55\ufe0f',
  1651. 'o2':'\ud83c\udd7e\ufe0f',
  1652. 'ocean':'\ud83c\udf0a',
  1653. 'octopus':'\ud83d\udc19',
  1654. 'oden':'\ud83c\udf62',
  1655. 'office':'\ud83c\udfe2',
  1656. 'oil_drum':'\ud83d\udee2',
  1657. 'ok':'\ud83c\udd97',
  1658. 'ok_hand':'\ud83d\udc4c',
  1659. 'ok_man':'\ud83d\ude46&zwj;\u2642\ufe0f',
  1660. 'ok_woman':'\ud83d\ude46',
  1661. 'old_key':'\ud83d\udddd',
  1662. 'older_man':'\ud83d\udc74',
  1663. 'older_woman':'\ud83d\udc75',
  1664. 'om':'\ud83d\udd49',
  1665. 'on':'\ud83d\udd1b',
  1666. 'oncoming_automobile':'\ud83d\ude98',
  1667. 'oncoming_bus':'\ud83d\ude8d',
  1668. 'oncoming_police_car':'\ud83d\ude94',
  1669. 'oncoming_taxi':'\ud83d\ude96',
  1670. 'open_file_folder':'\ud83d\udcc2',
  1671. 'open_hands':'\ud83d\udc50',
  1672. 'open_mouth':'\ud83d\ude2e',
  1673. 'open_umbrella':'\u2602\ufe0f',
  1674. 'ophiuchus':'\u26ce',
  1675. 'orange_book':'\ud83d\udcd9',
  1676. 'orthodox_cross':'\u2626\ufe0f',
  1677. 'outbox_tray':'\ud83d\udce4',
  1678. 'owl':'\ud83e\udd89',
  1679. 'ox':'\ud83d\udc02',
  1680. 'package':'\ud83d\udce6',
  1681. 'page_facing_up':'\ud83d\udcc4',
  1682. 'page_with_curl':'\ud83d\udcc3',
  1683. 'pager':'\ud83d\udcdf',
  1684. 'paintbrush':'\ud83d\udd8c',
  1685. 'palm_tree':'\ud83c\udf34',
  1686. 'pancakes':'\ud83e\udd5e',
  1687. 'panda_face':'\ud83d\udc3c',
  1688. 'paperclip':'\ud83d\udcce',
  1689. 'paperclips':'\ud83d\udd87',
  1690. 'parasol_on_ground':'\u26f1',
  1691. 'parking':'\ud83c\udd7f\ufe0f',
  1692. 'part_alternation_mark':'\u303d\ufe0f',
  1693. 'partly_sunny':'\u26c5\ufe0f',
  1694. 'passenger_ship':'\ud83d\udef3',
  1695. 'passport_control':'\ud83d\udec2',
  1696. 'pause_button':'\u23f8',
  1697. 'peace_symbol':'\u262e\ufe0f',
  1698. 'peach':'\ud83c\udf51',
  1699. 'peanuts':'\ud83e\udd5c',
  1700. 'pear':'\ud83c\udf50',
  1701. 'pen':'\ud83d\udd8a',
  1702. 'pencil2':'\u270f\ufe0f',
  1703. 'penguin':'\ud83d\udc27',
  1704. 'pensive':'\ud83d\ude14',
  1705. 'performing_arts':'\ud83c\udfad',
  1706. 'persevere':'\ud83d\ude23',
  1707. 'person_fencing':'\ud83e\udd3a',
  1708. 'pouting_woman':'\ud83d\ude4e',
  1709. 'phone':'\u260e\ufe0f',
  1710. 'pick':'\u26cf',
  1711. 'pig':'\ud83d\udc37',
  1712. 'pig2':'\ud83d\udc16',
  1713. 'pig_nose':'\ud83d\udc3d',
  1714. 'pill':'\ud83d\udc8a',
  1715. 'pineapple':'\ud83c\udf4d',
  1716. 'ping_pong':'\ud83c\udfd3',
  1717. 'pisces':'\u2653\ufe0f',
  1718. 'pizza':'\ud83c\udf55',
  1719. 'place_of_worship':'\ud83d\uded0',
  1720. 'plate_with_cutlery':'\ud83c\udf7d',
  1721. 'play_or_pause_button':'\u23ef',
  1722. 'point_down':'\ud83d\udc47',
  1723. 'point_left':'\ud83d\udc48',
  1724. 'point_right':'\ud83d\udc49',
  1725. 'point_up':'\u261d\ufe0f',
  1726. 'point_up_2':'\ud83d\udc46',
  1727. 'police_car':'\ud83d\ude93',
  1728. 'policewoman':'\ud83d\udc6e&zwj;\u2640\ufe0f',
  1729. 'poodle':'\ud83d\udc29',
  1730. 'popcorn':'\ud83c\udf7f',
  1731. 'post_office':'\ud83c\udfe3',
  1732. 'postal_horn':'\ud83d\udcef',
  1733. 'postbox':'\ud83d\udcee',
  1734. 'potable_water':'\ud83d\udeb0',
  1735. 'potato':'\ud83e\udd54',
  1736. 'pouch':'\ud83d\udc5d',
  1737. 'poultry_leg':'\ud83c\udf57',
  1738. 'pound':'\ud83d\udcb7',
  1739. 'rage':'\ud83d\ude21',
  1740. 'pouting_cat':'\ud83d\ude3e',
  1741. 'pouting_man':'\ud83d\ude4e&zwj;\u2642\ufe0f',
  1742. 'pray':'\ud83d\ude4f',
  1743. 'prayer_beads':'\ud83d\udcff',
  1744. 'pregnant_woman':'\ud83e\udd30',
  1745. 'previous_track_button':'\u23ee',
  1746. 'prince':'\ud83e\udd34',
  1747. 'princess':'\ud83d\udc78',
  1748. 'printer':'\ud83d\udda8',
  1749. 'purple_heart':'\ud83d\udc9c',
  1750. 'purse':'\ud83d\udc5b',
  1751. 'pushpin':'\ud83d\udccc',
  1752. 'put_litter_in_its_place':'\ud83d\udeae',
  1753. 'question':'\u2753',
  1754. 'rabbit':'\ud83d\udc30',
  1755. 'rabbit2':'\ud83d\udc07',
  1756. 'racehorse':'\ud83d\udc0e',
  1757. 'racing_car':'\ud83c\udfce',
  1758. 'radio':'\ud83d\udcfb',
  1759. 'radio_button':'\ud83d\udd18',
  1760. 'radioactive':'\u2622\ufe0f',
  1761. 'railway_car':'\ud83d\ude83',
  1762. 'railway_track':'\ud83d\udee4',
  1763. 'rainbow':'\ud83c\udf08',
  1764. 'rainbow_flag':'\ud83c\udff3\ufe0f&zwj;\ud83c\udf08',
  1765. 'raised_back_of_hand':'\ud83e\udd1a',
  1766. 'raised_hand_with_fingers_splayed':'\ud83d\udd90',
  1767. 'raised_hands':'\ud83d\ude4c',
  1768. 'raising_hand_woman':'\ud83d\ude4b',
  1769. 'raising_hand_man':'\ud83d\ude4b&zwj;\u2642\ufe0f',
  1770. 'ram':'\ud83d\udc0f',
  1771. 'ramen':'\ud83c\udf5c',
  1772. 'rat':'\ud83d\udc00',
  1773. 'record_button':'\u23fa',
  1774. 'recycle':'\u267b\ufe0f',
  1775. 'red_circle':'\ud83d\udd34',
  1776. 'registered':'\u00ae\ufe0f',
  1777. 'relaxed':'\u263a\ufe0f',
  1778. 'relieved':'\ud83d\ude0c',
  1779. 'reminder_ribbon':'\ud83c\udf97',
  1780. 'repeat':'\ud83d\udd01',
  1781. 'repeat_one':'\ud83d\udd02',
  1782. 'rescue_worker_helmet':'\u26d1',
  1783. 'restroom':'\ud83d\udebb',
  1784. 'revolving_hearts':'\ud83d\udc9e',
  1785. 'rewind':'\u23ea',
  1786. 'rhinoceros':'\ud83e\udd8f',
  1787. 'ribbon':'\ud83c\udf80',
  1788. 'rice':'\ud83c\udf5a',
  1789. 'rice_ball':'\ud83c\udf59',
  1790. 'rice_cracker':'\ud83c\udf58',
  1791. 'rice_scene':'\ud83c\udf91',
  1792. 'right_anger_bubble':'\ud83d\uddef',
  1793. 'ring':'\ud83d\udc8d',
  1794. 'robot':'\ud83e\udd16',
  1795. 'rocket':'\ud83d\ude80',
  1796. 'rofl':'\ud83e\udd23',
  1797. 'roll_eyes':'\ud83d\ude44',
  1798. 'roller_coaster':'\ud83c\udfa2',
  1799. 'rooster':'\ud83d\udc13',
  1800. 'rose':'\ud83c\udf39',
  1801. 'rosette':'\ud83c\udff5',
  1802. 'rotating_light':'\ud83d\udea8',
  1803. 'round_pushpin':'\ud83d\udccd',
  1804. 'rowing_man':'\ud83d\udea3',
  1805. 'rowing_woman':'\ud83d\udea3&zwj;\u2640\ufe0f',
  1806. 'rugby_football':'\ud83c\udfc9',
  1807. 'running_man':'\ud83c\udfc3',
  1808. 'running_shirt_with_sash':'\ud83c\udfbd',
  1809. 'running_woman':'\ud83c\udfc3&zwj;\u2640\ufe0f',
  1810. 'sa':'\ud83c\ude02\ufe0f',
  1811. 'sagittarius':'\u2650\ufe0f',
  1812. 'sake':'\ud83c\udf76',
  1813. 'sandal':'\ud83d\udc61',
  1814. 'santa':'\ud83c\udf85',
  1815. 'satellite':'\ud83d\udce1',
  1816. 'saxophone':'\ud83c\udfb7',
  1817. 'school':'\ud83c\udfeb',
  1818. 'school_satchel':'\ud83c\udf92',
  1819. 'scissors':'\u2702\ufe0f',
  1820. 'scorpion':'\ud83e\udd82',
  1821. 'scorpius':'\u264f\ufe0f',
  1822. 'scream':'\ud83d\ude31',
  1823. 'scream_cat':'\ud83d\ude40',
  1824. 'scroll':'\ud83d\udcdc',
  1825. 'seat':'\ud83d\udcba',
  1826. 'secret':'\u3299\ufe0f',
  1827. 'see_no_evil':'\ud83d\ude48',
  1828. 'seedling':'\ud83c\udf31',
  1829. 'selfie':'\ud83e\udd33',
  1830. 'shallow_pan_of_food':'\ud83e\udd58',
  1831. 'shamrock':'\u2618\ufe0f',
  1832. 'shark':'\ud83e\udd88',
  1833. 'shaved_ice':'\ud83c\udf67',
  1834. 'sheep':'\ud83d\udc11',
  1835. 'shell':'\ud83d\udc1a',
  1836. 'shield':'\ud83d\udee1',
  1837. 'shinto_shrine':'\u26e9',
  1838. 'ship':'\ud83d\udea2',
  1839. 'shirt':'\ud83d\udc55',
  1840. 'shopping':'\ud83d\udecd',
  1841. 'shopping_cart':'\ud83d\uded2',
  1842. 'shower':'\ud83d\udebf',
  1843. 'shrimp':'\ud83e\udd90',
  1844. 'signal_strength':'\ud83d\udcf6',
  1845. 'six_pointed_star':'\ud83d\udd2f',
  1846. 'ski':'\ud83c\udfbf',
  1847. 'skier':'\u26f7',
  1848. 'skull':'\ud83d\udc80',
  1849. 'skull_and_crossbones':'\u2620\ufe0f',
  1850. 'sleeping':'\ud83d\ude34',
  1851. 'sleeping_bed':'\ud83d\udecc',
  1852. 'sleepy':'\ud83d\ude2a',
  1853. 'slightly_frowning_face':'\ud83d\ude41',
  1854. 'slightly_smiling_face':'\ud83d\ude42',
  1855. 'slot_machine':'\ud83c\udfb0',
  1856. 'small_airplane':'\ud83d\udee9',
  1857. 'small_blue_diamond':'\ud83d\udd39',
  1858. 'small_orange_diamond':'\ud83d\udd38',
  1859. 'small_red_triangle':'\ud83d\udd3a',
  1860. 'small_red_triangle_down':'\ud83d\udd3b',
  1861. 'smile':'\ud83d\ude04',
  1862. 'smile_cat':'\ud83d\ude38',
  1863. 'smiley':'\ud83d\ude03',
  1864. 'smiley_cat':'\ud83d\ude3a',
  1865. 'smiling_imp':'\ud83d\ude08',
  1866. 'smirk':'\ud83d\ude0f',
  1867. 'smirk_cat':'\ud83d\ude3c',
  1868. 'smoking':'\ud83d\udeac',
  1869. 'snail':'\ud83d\udc0c',
  1870. 'snake':'\ud83d\udc0d',
  1871. 'sneezing_face':'\ud83e\udd27',
  1872. 'snowboarder':'\ud83c\udfc2',
  1873. 'snowflake':'\u2744\ufe0f',
  1874. 'snowman':'\u26c4\ufe0f',
  1875. 'snowman_with_snow':'\u2603\ufe0f',
  1876. 'sob':'\ud83d\ude2d',
  1877. 'soccer':'\u26bd\ufe0f',
  1878. 'soon':'\ud83d\udd1c',
  1879. 'sos':'\ud83c\udd98',
  1880. 'sound':'\ud83d\udd09',
  1881. 'space_invader':'\ud83d\udc7e',
  1882. 'spades':'\u2660\ufe0f',
  1883. 'spaghetti':'\ud83c\udf5d',
  1884. 'sparkle':'\u2747\ufe0f',
  1885. 'sparkler':'\ud83c\udf87',
  1886. 'sparkles':'\u2728',
  1887. 'sparkling_heart':'\ud83d\udc96',
  1888. 'speak_no_evil':'\ud83d\ude4a',
  1889. 'speaker':'\ud83d\udd08',
  1890. 'speaking_head':'\ud83d\udde3',
  1891. 'speech_balloon':'\ud83d\udcac',
  1892. 'speedboat':'\ud83d\udea4',
  1893. 'spider':'\ud83d\udd77',
  1894. 'spider_web':'\ud83d\udd78',
  1895. 'spiral_calendar':'\ud83d\uddd3',
  1896. 'spiral_notepad':'\ud83d\uddd2',
  1897. 'spoon':'\ud83e\udd44',
  1898. 'squid':'\ud83e\udd91',
  1899. 'stadium':'\ud83c\udfdf',
  1900. 'star':'\u2b50\ufe0f',
  1901. 'star2':'\ud83c\udf1f',
  1902. 'star_and_crescent':'\u262a\ufe0f',
  1903. 'star_of_david':'\u2721\ufe0f',
  1904. 'stars':'\ud83c\udf20',
  1905. 'station':'\ud83d\ude89',
  1906. 'statue_of_liberty':'\ud83d\uddfd',
  1907. 'steam_locomotive':'\ud83d\ude82',
  1908. 'stew':'\ud83c\udf72',
  1909. 'stop_button':'\u23f9',
  1910. 'stop_sign':'\ud83d\uded1',
  1911. 'stopwatch':'\u23f1',
  1912. 'straight_ruler':'\ud83d\udccf',
  1913. 'strawberry':'\ud83c\udf53',
  1914. 'stuck_out_tongue':'\ud83d\ude1b',
  1915. 'stuck_out_tongue_closed_eyes':'\ud83d\ude1d',
  1916. 'stuck_out_tongue_winking_eye':'\ud83d\ude1c',
  1917. 'studio_microphone':'\ud83c\udf99',
  1918. 'stuffed_flatbread':'\ud83e\udd59',
  1919. 'sun_behind_large_cloud':'\ud83c\udf25',
  1920. 'sun_behind_rain_cloud':'\ud83c\udf26',
  1921. 'sun_behind_small_cloud':'\ud83c\udf24',
  1922. 'sun_with_face':'\ud83c\udf1e',
  1923. 'sunflower':'\ud83c\udf3b',
  1924. 'sunglasses':'\ud83d\ude0e',
  1925. 'sunny':'\u2600\ufe0f',
  1926. 'sunrise':'\ud83c\udf05',
  1927. 'sunrise_over_mountains':'\ud83c\udf04',
  1928. 'surfing_man':'\ud83c\udfc4',
  1929. 'surfing_woman':'\ud83c\udfc4&zwj;\u2640\ufe0f',
  1930. 'sushi':'\ud83c\udf63',
  1931. 'suspension_railway':'\ud83d\ude9f',
  1932. 'sweat':'\ud83d\ude13',
  1933. 'sweat_drops':'\ud83d\udca6',
  1934. 'sweat_smile':'\ud83d\ude05',
  1935. 'sweet_potato':'\ud83c\udf60',
  1936. 'swimming_man':'\ud83c\udfca',
  1937. 'swimming_woman':'\ud83c\udfca&zwj;\u2640\ufe0f',
  1938. 'symbols':'\ud83d\udd23',
  1939. 'synagogue':'\ud83d\udd4d',
  1940. 'syringe':'\ud83d\udc89',
  1941. 'taco':'\ud83c\udf2e',
  1942. 'tada':'\ud83c\udf89',
  1943. 'tanabata_tree':'\ud83c\udf8b',
  1944. 'taurus':'\u2649\ufe0f',
  1945. 'taxi':'\ud83d\ude95',
  1946. 'tea':'\ud83c\udf75',
  1947. 'telephone_receiver':'\ud83d\udcde',
  1948. 'telescope':'\ud83d\udd2d',
  1949. 'tennis':'\ud83c\udfbe',
  1950. 'tent':'\u26fa\ufe0f',
  1951. 'thermometer':'\ud83c\udf21',
  1952. 'thinking':'\ud83e\udd14',
  1953. 'thought_balloon':'\ud83d\udcad',
  1954. 'ticket':'\ud83c\udfab',
  1955. 'tickets':'\ud83c\udf9f',
  1956. 'tiger':'\ud83d\udc2f',
  1957. 'tiger2':'\ud83d\udc05',
  1958. 'timer_clock':'\u23f2',
  1959. 'tipping_hand_man':'\ud83d\udc81&zwj;\u2642\ufe0f',
  1960. 'tired_face':'\ud83d\ude2b',
  1961. 'tm':'\u2122\ufe0f',
  1962. 'toilet':'\ud83d\udebd',
  1963. 'tokyo_tower':'\ud83d\uddfc',
  1964. 'tomato':'\ud83c\udf45',
  1965. 'tongue':'\ud83d\udc45',
  1966. 'top':'\ud83d\udd1d',
  1967. 'tophat':'\ud83c\udfa9',
  1968. 'tornado':'\ud83c\udf2a',
  1969. 'trackball':'\ud83d\uddb2',
  1970. 'tractor':'\ud83d\ude9c',
  1971. 'traffic_light':'\ud83d\udea5',
  1972. 'train':'\ud83d\ude8b',
  1973. 'train2':'\ud83d\ude86',
  1974. 'tram':'\ud83d\ude8a',
  1975. 'triangular_flag_on_post':'\ud83d\udea9',
  1976. 'triangular_ruler':'\ud83d\udcd0',
  1977. 'trident':'\ud83d\udd31',
  1978. 'triumph':'\ud83d\ude24',
  1979. 'trolleybus':'\ud83d\ude8e',
  1980. 'trophy':'\ud83c\udfc6',
  1981. 'tropical_drink':'\ud83c\udf79',
  1982. 'tropical_fish':'\ud83d\udc20',
  1983. 'truck':'\ud83d\ude9a',
  1984. 'trumpet':'\ud83c\udfba',
  1985. 'tulip':'\ud83c\udf37',
  1986. 'tumbler_glass':'\ud83e\udd43',
  1987. 'turkey':'\ud83e\udd83',
  1988. 'turtle':'\ud83d\udc22',
  1989. 'tv':'\ud83d\udcfa',
  1990. 'twisted_rightwards_arrows':'\ud83d\udd00',
  1991. 'two_hearts':'\ud83d\udc95',
  1992. 'two_men_holding_hands':'\ud83d\udc6c',
  1993. 'two_women_holding_hands':'\ud83d\udc6d',
  1994. 'u5272':'\ud83c\ude39',
  1995. 'u5408':'\ud83c\ude34',
  1996. 'u55b6':'\ud83c\ude3a',
  1997. 'u6307':'\ud83c\ude2f\ufe0f',
  1998. 'u6708':'\ud83c\ude37\ufe0f',
  1999. 'u6709':'\ud83c\ude36',
  2000. 'u6e80':'\ud83c\ude35',
  2001. 'u7121':'\ud83c\ude1a\ufe0f',
  2002. 'u7533':'\ud83c\ude38',
  2003. 'u7981':'\ud83c\ude32',
  2004. 'u7a7a':'\ud83c\ude33',
  2005. 'umbrella':'\u2614\ufe0f',
  2006. 'unamused':'\ud83d\ude12',
  2007. 'underage':'\ud83d\udd1e',
  2008. 'unicorn':'\ud83e\udd84',
  2009. 'unlock':'\ud83d\udd13',
  2010. 'up':'\ud83c\udd99',
  2011. 'upside_down_face':'\ud83d\ude43',
  2012. 'v':'\u270c\ufe0f',
  2013. 'vertical_traffic_light':'\ud83d\udea6',
  2014. 'vhs':'\ud83d\udcfc',
  2015. 'vibration_mode':'\ud83d\udcf3',
  2016. 'video_camera':'\ud83d\udcf9',
  2017. 'video_game':'\ud83c\udfae',
  2018. 'violin':'\ud83c\udfbb',
  2019. 'virgo':'\u264d\ufe0f',
  2020. 'volcano':'\ud83c\udf0b',
  2021. 'volleyball':'\ud83c\udfd0',
  2022. 'vs':'\ud83c\udd9a',
  2023. 'vulcan_salute':'\ud83d\udd96',
  2024. 'walking_man':'\ud83d\udeb6',
  2025. 'walking_woman':'\ud83d\udeb6&zwj;\u2640\ufe0f',
  2026. 'waning_crescent_moon':'\ud83c\udf18',
  2027. 'waning_gibbous_moon':'\ud83c\udf16',
  2028. 'warning':'\u26a0\ufe0f',
  2029. 'wastebasket':'\ud83d\uddd1',
  2030. 'watch':'\u231a\ufe0f',
  2031. 'water_buffalo':'\ud83d\udc03',
  2032. 'watermelon':'\ud83c\udf49',
  2033. 'wave':'\ud83d\udc4b',
  2034. 'wavy_dash':'\u3030\ufe0f',
  2035. 'waxing_crescent_moon':'\ud83c\udf12',
  2036. 'wc':'\ud83d\udebe',
  2037. 'weary':'\ud83d\ude29',
  2038. 'wedding':'\ud83d\udc92',
  2039. 'weight_lifting_man':'\ud83c\udfcb\ufe0f',
  2040. 'weight_lifting_woman':'\ud83c\udfcb\ufe0f&zwj;\u2640\ufe0f',
  2041. 'whale':'\ud83d\udc33',
  2042. 'whale2':'\ud83d\udc0b',
  2043. 'wheel_of_dharma':'\u2638\ufe0f',
  2044. 'wheelchair':'\u267f\ufe0f',
  2045. 'white_check_mark':'\u2705',
  2046. 'white_circle':'\u26aa\ufe0f',
  2047. 'white_flag':'\ud83c\udff3\ufe0f',
  2048. 'white_flower':'\ud83d\udcae',
  2049. 'white_large_square':'\u2b1c\ufe0f',
  2050. 'white_medium_small_square':'\u25fd\ufe0f',
  2051. 'white_medium_square':'\u25fb\ufe0f',
  2052. 'white_small_square':'\u25ab\ufe0f',
  2053. 'white_square_button':'\ud83d\udd33',
  2054. 'wilted_flower':'\ud83e\udd40',
  2055. 'wind_chime':'\ud83c\udf90',
  2056. 'wind_face':'\ud83c\udf2c',
  2057. 'wine_glass':'\ud83c\udf77',
  2058. 'wink':'\ud83d\ude09',
  2059. 'wolf':'\ud83d\udc3a',
  2060. 'woman':'\ud83d\udc69',
  2061. 'woman_artist':'\ud83d\udc69&zwj;\ud83c\udfa8',
  2062. 'woman_astronaut':'\ud83d\udc69&zwj;\ud83d\ude80',
  2063. 'woman_cartwheeling':'\ud83e\udd38&zwj;\u2640\ufe0f',
  2064. 'woman_cook':'\ud83d\udc69&zwj;\ud83c\udf73',
  2065. 'woman_facepalming':'\ud83e\udd26&zwj;\u2640\ufe0f',
  2066. 'woman_factory_worker':'\ud83d\udc69&zwj;\ud83c\udfed',
  2067. 'woman_farmer':'\ud83d\udc69&zwj;\ud83c\udf3e',
  2068. 'woman_firefighter':'\ud83d\udc69&zwj;\ud83d\ude92',
  2069. 'woman_health_worker':'\ud83d\udc69&zwj;\u2695\ufe0f',
  2070. 'woman_judge':'\ud83d\udc69&zwj;\u2696\ufe0f',
  2071. 'woman_juggling':'\ud83e\udd39&zwj;\u2640\ufe0f',
  2072. 'woman_mechanic':'\ud83d\udc69&zwj;\ud83d\udd27',
  2073. 'woman_office_worker':'\ud83d\udc69&zwj;\ud83d\udcbc',
  2074. 'woman_pilot':'\ud83d\udc69&zwj;\u2708\ufe0f',
  2075. 'woman_playing_handball':'\ud83e\udd3e&zwj;\u2640\ufe0f',
  2076. 'woman_playing_water_polo':'\ud83e\udd3d&zwj;\u2640\ufe0f',
  2077. 'woman_scientist':'\ud83d\udc69&zwj;\ud83d\udd2c',
  2078. 'woman_shrugging':'\ud83e\udd37&zwj;\u2640\ufe0f',
  2079. 'woman_singer':'\ud83d\udc69&zwj;\ud83c\udfa4',
  2080. 'woman_student':'\ud83d\udc69&zwj;\ud83c\udf93',
  2081. 'woman_teacher':'\ud83d\udc69&zwj;\ud83c\udfeb',
  2082. 'woman_technologist':'\ud83d\udc69&zwj;\ud83d\udcbb',
  2083. 'woman_with_turban':'\ud83d\udc73&zwj;\u2640\ufe0f',
  2084. 'womans_clothes':'\ud83d\udc5a',
  2085. 'womans_hat':'\ud83d\udc52',
  2086. 'women_wrestling':'\ud83e\udd3c&zwj;\u2640\ufe0f',
  2087. 'womens':'\ud83d\udeba',
  2088. 'world_map':'\ud83d\uddfa',
  2089. 'worried':'\ud83d\ude1f',
  2090. 'wrench':'\ud83d\udd27',
  2091. 'writing_hand':'\u270d\ufe0f',
  2092. 'x':'\u274c',
  2093. 'yellow_heart':'\ud83d\udc9b',
  2094. 'yen':'\ud83d\udcb4',
  2095. 'yin_yang':'\u262f\ufe0f',
  2096. 'yum':'\ud83d\ude0b',
  2097. 'zap':'\u26a1\ufe0f',
  2098. 'zipper_mouth_face':'\ud83e\udd10',
  2099. 'zzz':'\ud83d\udca4',
  2100. /* special emojis :P */
  2101. 'octocat': '<img width="20" height="20" align="absmiddle" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAOwUlEQVR42uVbCVyO6RbPmn0sw9gZS0aZO4y5GTEUE2ObxjZjrbHEJVy3sWS5pkaWxjLEkCVDSbSgFLdESaWSLIVUSIi4kvb9f895vi/zbbR+yZ339/tbnu99n/ec/3Oe85xznufV0CjDBaAdwZqwnzCJ0FXjHV70/i8J5oQDhCFV8cJdq1atwqxZs+Ds7Iz4+HhqwgXCLELNKlK6G2Ej4e6lS5ewZcsWzJgxA+fOnWNZFqvzxT1v3boF/qcsBg0ahP3796OwsJAFWKYuIqjfPoS9cXFxWL58Obp06SInh5aWFr//jjoJWLlu3TolAorRuXNn7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NLKlStFXV+2javQ/M1SpZe+1KA4L4G7WDG57fSm/OUbXiqG0ewAFYOeYcN4fwZhvLkp2y4tftrxcltdlf/w+fPn4qNGxTCYU2m6nrRu3VqunT/EoiuZvw6TTZHpyuNNmEaNGsndP3fu3OJAq1N1JOAHDmyKheVtNP4OkE2crULRAW7fvl20EyyLy24a8p+/7WISFixYIMLt4t82bNhQYjXqXREgPq3j74mlX3AmSL8E1eOPIBXnuVT5OsVZpuLnOMeOHeN7vifwiYhYzhC5IpwlOXj1QXWdBmy/XWU/X+UqMZfKBw4cKAobHPlJlZe9h6tOu+7cuSN2dg0MDMSSyZUpmXvaSD+crq/xvl0k9BTCRa7qEPq+5T4t6ffF52WVV+f1P6zyLG30bsU4AAAAAElFTkSuQmCC">',
  2102. 'showdown': '<img width="20" height="20" align="absmiddle" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC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lmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NjQ8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+NjQ8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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FSEkqbJiWn0P0OMSGqlWiOu0TvD+FRHZKAE+oW+cfRmEwqlsesJJEJs8y91QqP+9UL6lqEtz2gpuNEY5sm9sIHln2DRa2aFKGJtiXkZEMiWtgVvRKUSUFkSKt2S7fAGgAXLYpmQQXf36MUChTZdUa2u8/rkvPA6Tz30r4eH3ybcBS5gJ6SaNXb+aABkA1AMxKenclBZLW/He4cYEGwEXb3wEASelexk6LIIIAAAAASUVORK5CYII=">'
  2103. };
  2104. /**
  2105. * Turn Markdown link shortcuts into XHTML <a> tags.
  2106. */
  2107. showdown.subParser('makehtml.anchors', function (text, options, globals) {
  2108. 'use strict';
  2109. text = globals.converter._dispatch('makehtml.anchors.before', text, options, globals);
  2110. var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
  2111. if (showdown.helper.isUndefined(title)) {
  2112. title = '';
  2113. }
  2114. linkId = linkId.toLowerCase();
  2115. // Special case for explicit empty url
  2116. if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
  2117. url = '';
  2118. } else if (!url) {
  2119. if (!linkId) {
  2120. // lower-case and turn embedded newlines into spaces
  2121. linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
  2122. }
  2123. url = '#' + linkId;
  2124. if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
  2125. url = globals.gUrls[linkId];
  2126. if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
  2127. title = globals.gTitles[linkId];
  2128. }
  2129. } else {
  2130. return wholeMatch;
  2131. }
  2132. }
  2133. //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
  2134. url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2135. var result = '<a href="' + url + '"';
  2136. if (title !== '' && title !== null) {
  2137. title = title.replace(/"/g, '&quot;');
  2138. //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
  2139. title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2140. result += ' title="' + title + '"';
  2141. }
  2142. // optionLinksInNewWindow only applies
  2143. // to external links. Hash links (#) open in same page
  2144. if (options.openLinksInNewWindow && !/^#/.test(url)) {
  2145. // escaped _
  2146. result += ' target="¨E95Eblank"';
  2147. }
  2148. result += '>' + linkText + '</a>';
  2149. return result;
  2150. };
  2151. // First, handle reference-style links: [link text] [id]
  2152. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
  2153. // Next, inline-style links: [link text](url "optional title")
  2154. // cases with crazy urls like ./image/cat1).png
  2155. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
  2156. writeAnchorTag);
  2157. // normal cases
  2158. text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
  2159. writeAnchorTag);
  2160. // handle reference-style shortcuts: [link text]
  2161. // These must come last in case you've also got [link test][1]
  2162. // or [link test](/foo)
  2163. text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
  2164. // Lastly handle GithubMentions if option is enabled
  2165. if (options.ghMentions) {
  2166. text = text.replace(/(^|\s)(\\)?(@([a-z\d\-]+))(?=[.!?;,[\]()]|\s|$)/gmi, function (wm, st, escape, mentions, username) {
  2167. if (escape === '\\') {
  2168. return st + mentions;
  2169. }
  2170. //check if options.ghMentionsLink is a string
  2171. if (!showdown.helper.isString(options.ghMentionsLink)) {
  2172. throw new Error('ghMentionsLink option must be a string');
  2173. }
  2174. var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
  2175. target = '';
  2176. if (options.openLinksInNewWindow) {
  2177. target = ' target="¨E95Eblank"';
  2178. }
  2179. return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
  2180. });
  2181. }
  2182. text = globals.converter._dispatch('makehtml.anchors.after', text, options, globals);
  2183. return text;
  2184. });
  2185. // url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
  2186. var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
  2187. simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
  2188. delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
  2189. simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
  2190. delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
  2191. replaceLink = function (options) {
  2192. 'use strict';
  2193. return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
  2194. link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2195. var lnkTxt = link,
  2196. append = '',
  2197. target = '',
  2198. lmc = leadingMagicChars || '',
  2199. tmc = trailingMagicChars || '';
  2200. if (/^www\./i.test(link)) {
  2201. link = link.replace(/^www\./i, 'http://www.');
  2202. }
  2203. if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
  2204. append = trailingPunctuation;
  2205. }
  2206. if (options.openLinksInNewWindow) {
  2207. target = ' target="¨E95Eblank"';
  2208. }
  2209. return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
  2210. };
  2211. },
  2212. replaceMail = function (options, globals) {
  2213. 'use strict';
  2214. return function (wholeMatch, b, mail) {
  2215. var href = 'mailto:';
  2216. b = b || '';
  2217. mail = showdown.subParser('makehtml.unescapeSpecialChars')(mail, options, globals);
  2218. if (options.encodeEmails) {
  2219. href = showdown.helper.encodeEmailAddress(href + mail);
  2220. mail = showdown.helper.encodeEmailAddress(mail);
  2221. } else {
  2222. href = href + mail;
  2223. }
  2224. return b + '<a href="' + href + '">' + mail + '</a>';
  2225. };
  2226. };
  2227. showdown.subParser('makehtml.autoLinks', function (text, options, globals) {
  2228. 'use strict';
  2229. text = globals.converter._dispatch('makehtml.autoLinks.before', text, options, globals);
  2230. text = text.replace(delimUrlRegex, replaceLink(options));
  2231. text = text.replace(delimMailRegex, replaceMail(options, globals));
  2232. text = globals.converter._dispatch('makehtml.autoLinks.after', text, options, globals);
  2233. return text;
  2234. });
  2235. showdown.subParser('makehtml.simplifiedAutoLinks', function (text, options, globals) {
  2236. 'use strict';
  2237. if (!options.simplifiedAutoLink) {
  2238. return text;
  2239. }
  2240. text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.before', text, options, globals);
  2241. if (options.excludeTrailingPunctuationFromURLs) {
  2242. text = text.replace(simpleURLRegex2, replaceLink(options));
  2243. } else {
  2244. text = text.replace(simpleURLRegex, replaceLink(options));
  2245. }
  2246. text = text.replace(simpleMailRegex, replaceMail(options, globals));
  2247. text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.after', text, options, globals);
  2248. return text;
  2249. });
  2250. /**
  2251. * These are all the transformations that form block-level
  2252. * tags like paragraphs, headers, and list items.
  2253. */
  2254. showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
  2255. 'use strict';
  2256. text = globals.converter._dispatch('makehtml.blockGamut.before', text, options, globals);
  2257. // we parse blockquotes first so that we can have headings and hrs
  2258. // inside blockquotes
  2259. text = showdown.subParser('makehtml.blockQuotes')(text, options, globals);
  2260. text = showdown.subParser('makehtml.headers')(text, options, globals);
  2261. // Do Horizontal Rules:
  2262. text = showdown.subParser('makehtml.horizontalRule')(text, options, globals);
  2263. text = showdown.subParser('makehtml.lists')(text, options, globals);
  2264. text = showdown.subParser('makehtml.codeBlocks')(text, options, globals);
  2265. text = showdown.subParser('makehtml.tables')(text, options, globals);
  2266. // We already ran _HashHTMLBlocks() before, in Markdown(), but that
  2267. // was to escape raw HTML in the original Markdown source. This time,
  2268. // we're escaping the markup we've just created, so that we don't wrap
  2269. // <p> tags around block-level tags.
  2270. text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
  2271. text = showdown.subParser('makehtml.paragraphs')(text, options, globals);
  2272. text = globals.converter._dispatch('makehtml.blockGamut.after', text, options, globals);
  2273. return text;
  2274. });
  2275. showdown.subParser('makehtml.blockQuotes', function (text, options, globals) {
  2276. 'use strict';
  2277. text = globals.converter._dispatch('makehtml.blockQuotes.before', text, options, globals);
  2278. // add a couple extra lines after the text and endtext mark
  2279. text = text + '\n\n';
  2280. var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
  2281. if (options.splitAdjacentBlockquotes) {
  2282. rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
  2283. }
  2284. text = text.replace(rgx, function (bq) {
  2285. // attacklab: hack around Konqueror 3.5.4 bug:
  2286. // "----------bug".replace(/^-/g,"") == "bug"
  2287. bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
  2288. // attacklab: clean up hack
  2289. bq = bq.replace(/¨0/g, '');
  2290. bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
  2291. bq = showdown.subParser('makehtml.githubCodeBlocks')(bq, options, globals);
  2292. bq = showdown.subParser('makehtml.blockGamut')(bq, options, globals); // recurse
  2293. bq = bq.replace(/(^|\n)/g, '$1 ');
  2294. // These leading spaces screw with <pre> content, so we need to fix that:
  2295. bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
  2296. var pre = m1;
  2297. // attacklab: hack around Konqueror 3.5.4 bug:
  2298. pre = pre.replace(/^ /mg, '¨0');
  2299. pre = pre.replace(/¨0/g, '');
  2300. return pre;
  2301. });
  2302. return showdown.subParser('makehtml.hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
  2303. });
  2304. text = globals.converter._dispatch('makehtml.blockQuotes.after', text, options, globals);
  2305. return text;
  2306. });
  2307. /**
  2308. * Process Markdown `<pre><code>` blocks.
  2309. */
  2310. showdown.subParser('makehtml.codeBlocks', function (text, options, globals) {
  2311. 'use strict';
  2312. text = globals.converter._dispatch('makehtml.codeBlocks.before', text, options, globals);
  2313. // sentinel workarounds for lack of \A and \Z, safari\khtml bug
  2314. text += '¨0';
  2315. var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
  2316. text = text.replace(pattern, function (wholeMatch, m1, m2) {
  2317. var codeblock = m1,
  2318. nextChar = m2,
  2319. end = '\n';
  2320. codeblock = showdown.subParser('makehtml.outdent')(codeblock, options, globals);
  2321. codeblock = showdown.subParser('makehtml.encodeCode')(codeblock, options, globals);
  2322. codeblock = showdown.subParser('makehtml.detab')(codeblock, options, globals);
  2323. codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
  2324. codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
  2325. if (options.omitExtraWLInCodeBlocks) {
  2326. end = '';
  2327. }
  2328. codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
  2329. return showdown.subParser('makehtml.hashBlock')(codeblock, options, globals) + nextChar;
  2330. });
  2331. // strip sentinel
  2332. text = text.replace(/¨0/, '');
  2333. text = globals.converter._dispatch('makehtml.codeBlocks.after', text, options, globals);
  2334. return text;
  2335. });
  2336. /**
  2337. *
  2338. * * Backtick quotes are used for <code></code> spans.
  2339. *
  2340. * * You can use multiple backticks as the delimiters if you want to
  2341. * include literal backticks in the code span. So, this input:
  2342. *
  2343. * Just type ``foo `bar` baz`` at the prompt.
  2344. *
  2345. * Will translate to:
  2346. *
  2347. * <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
  2348. *
  2349. * There's no arbitrary limit to the number of backticks you
  2350. * can use as delimters. If you need three consecutive backticks
  2351. * in your code, use four for delimiters, etc.
  2352. *
  2353. * * You can use spaces to get literal backticks at the edges:
  2354. *
  2355. * ... type `` `bar` `` ...
  2356. *
  2357. * Turns to:
  2358. *
  2359. * ... type <code>`bar`</code> ...
  2360. */
  2361. showdown.subParser('makehtml.codeSpans', function (text, options, globals) {
  2362. 'use strict';
  2363. text = globals.converter._dispatch('makehtml.codeSpans.before', text, options, globals);
  2364. if (typeof(text) === 'undefined') {
  2365. text = '';
  2366. }
  2367. text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
  2368. function (wholeMatch, m1, m2, m3) {
  2369. var c = m3;
  2370. c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
  2371. c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
  2372. c = showdown.subParser('makehtml.encodeCode')(c, options, globals);
  2373. c = m1 + '<code>' + c + '</code>';
  2374. c = showdown.subParser('makehtml.hashHTMLSpans')(c, options, globals);
  2375. return c;
  2376. }
  2377. );
  2378. text = globals.converter._dispatch('makehtml.codeSpans.after', text, options, globals);
  2379. return text;
  2380. });
  2381. /**
  2382. * Turn Markdown link shortcuts into XHTML <a> tags.
  2383. */
  2384. showdown.subParser('makehtml.completeHTMLDocument', function (text, options, globals) {
  2385. 'use strict';
  2386. if (!options.completeHTMLDocument) {
  2387. return text;
  2388. }
  2389. text = globals.converter._dispatch('makehtml.completeHTMLDocument.before', text, options, globals);
  2390. var doctype = 'html',
  2391. doctypeParsed = '<!DOCTYPE HTML>\n',
  2392. title = '',
  2393. charset = '<meta charset="utf-8">\n',
  2394. lang = '',
  2395. metadata = '';
  2396. if (typeof globals.metadata.parsed.doctype !== 'undefined') {
  2397. doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n';
  2398. doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
  2399. if (doctype === 'html' || doctype === 'html5') {
  2400. charset = '<meta charset="utf-8">';
  2401. }
  2402. }
  2403. for (var meta in globals.metadata.parsed) {
  2404. if (globals.metadata.parsed.hasOwnProperty(meta)) {
  2405. switch (meta.toLowerCase()) {
  2406. case 'doctype':
  2407. break;
  2408. case 'title':
  2409. title = '<title>' + globals.metadata.parsed.title + '</title>\n';
  2410. break;
  2411. case 'charset':
  2412. if (doctype === 'html' || doctype === 'html5') {
  2413. charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
  2414. } else {
  2415. charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
  2416. }
  2417. break;
  2418. case 'language':
  2419. case 'lang':
  2420. lang = ' lang="' + globals.metadata.parsed[meta] + '"';
  2421. metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
  2422. break;
  2423. default:
  2424. metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
  2425. }
  2426. }
  2427. }
  2428. text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
  2429. text = globals.converter._dispatch('makehtml.completeHTMLDocument.after', text, options, globals);
  2430. return text;
  2431. });
  2432. /**
  2433. * Convert all tabs to spaces
  2434. */
  2435. showdown.subParser('makehtml.detab', function (text, options, globals) {
  2436. 'use strict';
  2437. text = globals.converter._dispatch('makehtml.detab.before', text, options, globals);
  2438. // expand first n-1 tabs
  2439. text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width
  2440. // replace the nth with two sentinels
  2441. text = text.replace(/\t/g, '¨A¨B');
  2442. // use the sentinel to anchor our regex so it doesn't explode
  2443. text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
  2444. var leadingText = m1,
  2445. numSpaces = 4 - leadingText.length % 4; // g_tab_width
  2446. // there *must* be a better way to do this:
  2447. for (var i = 0; i < numSpaces; i++) {
  2448. leadingText += ' ';
  2449. }
  2450. return leadingText;
  2451. });
  2452. // clean up sentinels
  2453. text = text.replace(/¨A/g, ' '); // g_tab_width
  2454. text = text.replace(/¨B/g, '');
  2455. text = globals.converter._dispatch('makehtml.detab.after', text, options, globals);
  2456. return text;
  2457. });
  2458. showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
  2459. 'use strict';
  2460. text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals);
  2461. text = text.replace(/\.\.\./g, '…');
  2462. text = globals.converter._dispatch('makehtml.ellipsis.after', text, options, globals);
  2463. return text;
  2464. });
  2465. /**
  2466. * These are all the transformations that occur *within* block-level
  2467. * tags like paragraphs, headers, and list items.
  2468. */
  2469. showdown.subParser('makehtml.emoji', function (text, options, globals) {
  2470. 'use strict';
  2471. if (!options.emoji) {
  2472. return text;
  2473. }
  2474. text = globals.converter._dispatch('makehtml.emoji.before', text, options, globals);
  2475. var emojiRgx = /:([\S]+?):/g;
  2476. text = text.replace(emojiRgx, function (wm, emojiCode) {
  2477. if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
  2478. return showdown.helper.emojis[emojiCode];
  2479. }
  2480. return wm;
  2481. });
  2482. text = globals.converter._dispatch('makehtml.emoji.after', text, options, globals);
  2483. return text;
  2484. });
  2485. /**
  2486. * Smart processing for ampersands and angle brackets that need to be encoded.
  2487. */
  2488. showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, globals) {
  2489. 'use strict';
  2490. text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.before', text, options, globals);
  2491. // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
  2492. // http://bumppo.net/projects/amputator/
  2493. text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
  2494. // Encode naked <'s
  2495. text = text.replace(/<(?![a-z\/?$!])/gi, '&lt;');
  2496. // Encode <
  2497. text = text.replace(/</g, '&lt;');
  2498. // Encode >
  2499. text = text.replace(/>/g, '&gt;');
  2500. text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.after', text, options, globals);
  2501. return text;
  2502. });
  2503. /**
  2504. * Returns the string, with after processing the following backslash escape sequences.
  2505. *
  2506. * attacklab: The polite way to do this is with the new escapeCharacters() function:
  2507. *
  2508. * text = escapeCharacters(text,"\\",true);
  2509. * text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
  2510. *
  2511. * ...but we're sidestepping its use of the (slow) RegExp constructor
  2512. * as an optimization for Firefox. This function gets called a LOT.
  2513. */
  2514. showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, globals) {
  2515. 'use strict';
  2516. text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals);
  2517. text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
  2518. text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
  2519. text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals);
  2520. return text;
  2521. });
  2522. /**
  2523. * Encode/escape certain characters inside Markdown code runs.
  2524. * The point is that in code, these characters are literals,
  2525. * and lose their special Markdown meanings.
  2526. */
  2527. showdown.subParser('makehtml.encodeCode', function (text, options, globals) {
  2528. 'use strict';
  2529. text = globals.converter._dispatch('makehtml.encodeCode.before', text, options, globals);
  2530. // Encode all ampersands; HTML entities are not
  2531. // entities within a Markdown code span.
  2532. text = text
  2533. .replace(/&/g, '&amp;')
  2534. // Do the angle bracket song and dance:
  2535. .replace(/</g, '&lt;')
  2536. .replace(/>/g, '&gt;')
  2537. // Now, escape characters that are magic in Markdown:
  2538. .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
  2539. text = globals.converter._dispatch('makehtml.encodeCode.after', text, options, globals);
  2540. return text;
  2541. });
  2542. /**
  2543. * Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
  2544. * don't conflict with their use in Markdown for code, italics and strong.
  2545. */
  2546. showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
  2547. 'use strict';
  2548. text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
  2549. // Build a regex to find HTML tags.
  2550. var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
  2551. comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
  2552. text = text.replace(tags, function (wholeMatch) {
  2553. return wholeMatch
  2554. .replace(/(.)<\/?code>(?=.)/g, '$1`')
  2555. .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
  2556. });
  2557. text = text.replace(comments, function (wholeMatch) {
  2558. return wholeMatch
  2559. .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
  2560. });
  2561. text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
  2562. return text;
  2563. });
  2564. /**
  2565. * Handle github codeblocks prior to running HashHTML so that
  2566. * HTML contained within the codeblock gets escaped properly
  2567. * Example:
  2568. * ```ruby
  2569. * def hello_world(x)
  2570. * puts "Hello, #{x}"
  2571. * end
  2572. * ```
  2573. */
  2574. showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals) {
  2575. 'use strict';
  2576. // early exit if option is not enabled
  2577. if (!options.ghCodeBlocks) {
  2578. return text;
  2579. }
  2580. text = globals.converter._dispatch('makehtml.githubCodeBlocks.before', text, options, globals);
  2581. text += '¨0';
  2582. text = text.replace(/(?:^|\n)(```+|~~~+)([^\s`~]*)\n([\s\S]*?)\n\1/g, function (wholeMatch, delim, language, codeblock) {
  2583. var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
  2584. // First parse the github code block
  2585. codeblock = showdown.subParser('makehtml.encodeCode')(codeblock, options, globals);
  2586. codeblock = showdown.subParser('makehtml.detab')(codeblock, options, globals);
  2587. codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
  2588. codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
  2589. codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
  2590. codeblock = showdown.subParser('makehtml.hashBlock')(codeblock, options, globals);
  2591. // Since GHCodeblocks can be false positives, we need to
  2592. // store the primitive text and the parsed text in a global var,
  2593. // and then return a token
  2594. return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
  2595. });
  2596. // attacklab: strip sentinel
  2597. text = text.replace(/¨0/, '');
  2598. return globals.converter._dispatch('makehtml.githubCodeBlocks.after', text, options, globals);
  2599. });
  2600. showdown.subParser('makehtml.hashBlock', function (text, options, globals) {
  2601. 'use strict';
  2602. text = globals.converter._dispatch('makehtml.hashBlock.before', text, options, globals);
  2603. text = text.replace(/(^\n+|\n+$)/g, '');
  2604. text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
  2605. text = globals.converter._dispatch('makehtml.hashBlock.after', text, options, globals);
  2606. return text;
  2607. });
  2608. /**
  2609. * Hash and escape <code> elements that should not be parsed as markdown
  2610. */
  2611. showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) {
  2612. 'use strict';
  2613. text = globals.converter._dispatch('makehtml.hashCodeTags.before', text, options, globals);
  2614. var repFunc = function (wholeMatch, match, left, right) {
  2615. var codeblock = left + showdown.subParser('makehtml.encodeCode')(match, options, globals) + right;
  2616. return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
  2617. };
  2618. // Hash naked <code>
  2619. text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
  2620. text = globals.converter._dispatch('makehtml.hashCodeTags.after', text, options, globals);
  2621. return text;
  2622. });
  2623. showdown.subParser('makehtml.hashElement', function (text, options, globals) {
  2624. 'use strict';
  2625. return function (wholeMatch, m1) {
  2626. var blockText = m1;
  2627. // Undo double lines
  2628. blockText = blockText.replace(/\n\n/g, '\n');
  2629. blockText = blockText.replace(/^\n/, '');
  2630. // strip trailing blank lines
  2631. blockText = blockText.replace(/\n+$/g, '');
  2632. // Replace the element text with a marker ("¨KxK" where x is its key)
  2633. blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
  2634. return blockText;
  2635. };
  2636. });
  2637. showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals) {
  2638. 'use strict';
  2639. text = globals.converter._dispatch('makehtml.hashHTMLBlocks.before', text, options, globals);
  2640. var blockTags = [
  2641. 'pre',
  2642. 'div',
  2643. 'h1',
  2644. 'h2',
  2645. 'h3',
  2646. 'h4',
  2647. 'h5',
  2648. 'h6',
  2649. 'blockquote',
  2650. 'table',
  2651. 'dl',
  2652. 'ol',
  2653. 'ul',
  2654. 'script',
  2655. 'noscript',
  2656. 'form',
  2657. 'fieldset',
  2658. 'iframe',
  2659. 'math',
  2660. 'style',
  2661. 'section',
  2662. 'header',
  2663. 'footer',
  2664. 'nav',
  2665. 'article',
  2666. 'aside',
  2667. 'address',
  2668. 'audio',
  2669. 'canvas',
  2670. 'figure',
  2671. 'hgroup',
  2672. 'output',
  2673. 'video',
  2674. 'p'
  2675. ],
  2676. repFunc = function (wholeMatch, match, left, right) {
  2677. var txt = wholeMatch;
  2678. // check if this html element is marked as markdown
  2679. // if so, it's contents should be parsed as markdown
  2680. if (left.search(/\bmarkdown\b/) !== -1) {
  2681. txt = left + globals.converter.makeHtml(match) + right;
  2682. }
  2683. return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
  2684. };
  2685. if (options.backslashEscapesHTMLTags) {
  2686. // encode backslash escaped HTML tags
  2687. text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
  2688. return '&lt;' + inside + '&gt;';
  2689. });
  2690. }
  2691. // hash HTML Blocks
  2692. for (var i = 0; i < blockTags.length; ++i) {
  2693. var opTagPos,
  2694. rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
  2695. patLeft = '<' + blockTags[i] + '\\b[^>]*>',
  2696. patRight = '</' + blockTags[i] + '>';
  2697. // 1. Look for the first position of the first opening HTML tag in the text
  2698. while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
  2699. // if the HTML tag is \ escaped, we need to escape it and break
  2700. //2. Split the text in that position
  2701. var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
  2702. //3. Match recursively
  2703. newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
  2704. // prevent an infinite loop
  2705. if (newSubText1 === subTexts[1]) {
  2706. break;
  2707. }
  2708. text = subTexts[0].concat(newSubText1);
  2709. }
  2710. }
  2711. // HR SPECIAL CASE
  2712. text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
  2713. showdown.subParser('makehtml.hashElement')(text, options, globals));
  2714. // Special case for standalone HTML comments
  2715. text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
  2716. return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
  2717. }, '^ {0,3}<!--', '-->', 'gm');
  2718. // PHP and ASP-style processor instructions (<?...?> and <%...%>)
  2719. text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
  2720. showdown.subParser('makehtml.hashElement')(text, options, globals));
  2721. text = globals.converter._dispatch('makehtml.hashHTMLBlocks.after', text, options, globals);
  2722. return text;
  2723. });
  2724. /**
  2725. * Hash span elements that should not be parsed as markdown
  2726. */
  2727. showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
  2728. 'use strict';
  2729. text = globals.converter._dispatch('makehtml.hashHTMLSpans.before', text, options, globals);
  2730. function hashHTMLSpan (html) {
  2731. return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
  2732. }
  2733. // Hash Self Closing tags
  2734. text = text.replace(/<[^>]+?\/>/gi, function (wm) {
  2735. return hashHTMLSpan(wm);
  2736. });
  2737. // Hash tags without properties
  2738. text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
  2739. return hashHTMLSpan(wm);
  2740. });
  2741. // Hash tags with properties
  2742. text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
  2743. return hashHTMLSpan(wm);
  2744. });
  2745. // Hash self closing tags without />
  2746. text = text.replace(/<[^>]+?>/gi, function (wm) {
  2747. return hashHTMLSpan(wm);
  2748. });
  2749. /*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
  2750. text = globals.converter._dispatch('makehtml.hashHTMLSpans.after', text, options, globals);
  2751. return text;
  2752. });
  2753. /**
  2754. * Unhash HTML spans
  2755. */
  2756. showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals) {
  2757. 'use strict';
  2758. text = globals.converter._dispatch('makehtml.unhashHTMLSpans.before', text, options, globals);
  2759. for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
  2760. var repText = globals.gHtmlSpans[i],
  2761. // limiter to prevent infinite loop (assume 10 as limit for recurse)
  2762. limit = 0;
  2763. while (/¨C(\d+)C/.test(repText)) {
  2764. var num = RegExp.$1;
  2765. repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
  2766. if (limit === 10) {
  2767. console.error('maximum nesting of 10 spans reached!!!');
  2768. break;
  2769. }
  2770. ++limit;
  2771. }
  2772. text = text.replace('¨C' + i + 'C', repText);
  2773. }
  2774. text = globals.converter._dispatch('makehtml.unhashHTMLSpans.after', text, options, globals);
  2775. return text;
  2776. });
  2777. /**
  2778. * Hash and escape <pre><code> elements that should not be parsed as markdown
  2779. */
  2780. showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals) {
  2781. 'use strict';
  2782. text = globals.converter._dispatch('makehtml.hashPreCodeTags.before', text, options, globals);
  2783. var repFunc = function (wholeMatch, match, left, right) {
  2784. // encode html entities
  2785. var codeblock = left + showdown.subParser('makehtml.encodeCode')(match, options, globals) + right;
  2786. return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
  2787. };
  2788. // Hash <pre><code>
  2789. text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
  2790. text = globals.converter._dispatch('makehtml.hashPreCodeTags.after', text, options, globals);
  2791. return text;
  2792. });
  2793. showdown.subParser('makehtml.headers', function (text, options, globals) {
  2794. 'use strict';
  2795. text = globals.converter._dispatch('makehtml.headers.before', text, options, globals);
  2796. var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
  2797. // Set text-style headers:
  2798. // Header 1
  2799. // ========
  2800. //
  2801. // Header 2
  2802. // --------
  2803. //
  2804. setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
  2805. setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
  2806. text = text.replace(setextRegexH1, function (wholeMatch, m1) {
  2807. var spanGamut = showdown.subParser('makehtml.spanGamut')(m1, options, globals),
  2808. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
  2809. hLevel = headerLevelStart,
  2810. hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
  2811. return showdown.subParser('makehtml.hashBlock')(hashBlock, options, globals);
  2812. });
  2813. text = text.replace(setextRegexH2, function (matchFound, m1) {
  2814. var spanGamut = showdown.subParser('makehtml.spanGamut')(m1, options, globals),
  2815. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
  2816. hLevel = headerLevelStart + 1,
  2817. hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
  2818. return showdown.subParser('makehtml.hashBlock')(hashBlock, options, globals);
  2819. });
  2820. // atx-style headers:
  2821. // # Header 1
  2822. // ## Header 2
  2823. // ## Header 2 with closing hashes ##
  2824. // ...
  2825. // ###### Header 6
  2826. //
  2827. var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
  2828. text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
  2829. var hText = m2;
  2830. if (options.customizedHeaderId) {
  2831. hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
  2832. }
  2833. var span = showdown.subParser('makehtml.spanGamut')(hText, options, globals),
  2834. hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
  2835. hLevel = headerLevelStart - 1 + m1.length,
  2836. header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
  2837. return showdown.subParser('makehtml.hashBlock')(header, options, globals);
  2838. });
  2839. function headerId (m) {
  2840. var title,
  2841. prefix;
  2842. // It is separate from other options to allow combining prefix and customized
  2843. if (options.customizedHeaderId) {
  2844. var match = m.match(/\{([^{]+?)}\s*$/);
  2845. if (match && match[1]) {
  2846. m = match[1];
  2847. }
  2848. }
  2849. title = m;
  2850. // Prefix id to prevent causing inadvertent pre-existing style matches.
  2851. if (showdown.helper.isString(options.prefixHeaderId)) {
  2852. prefix = options.prefixHeaderId;
  2853. } else if (options.prefixHeaderId === true) {
  2854. prefix = 'section-';
  2855. } else {
  2856. prefix = '';
  2857. }
  2858. if (!options.rawPrefixHeaderId) {
  2859. title = prefix + title;
  2860. }
  2861. if (options.ghCompatibleHeaderId) {
  2862. title = title
  2863. .replace(/ /g, '-')
  2864. // replace previously escaped chars (&, ¨ and $)
  2865. .replace(/&amp;/g, '')
  2866. .replace(/¨T/g, '')
  2867. .replace(/¨D/g, '')
  2868. // replace rest of the chars (&~$ are repeated as they might have been escaped)
  2869. // borrowed from github's redcarpet (some they should produce similar results)
  2870. .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
  2871. .toLowerCase();
  2872. } else if (options.rawHeaderId) {
  2873. title = title
  2874. .replace(/ /g, '-')
  2875. // replace previously escaped chars (&, ¨ and $)
  2876. .replace(/&amp;/g, '&')
  2877. .replace(/¨T/g, '¨')
  2878. .replace(/¨D/g, '$')
  2879. // replace " and '
  2880. .replace(/["']/g, '-')
  2881. .toLowerCase();
  2882. } else {
  2883. title = title
  2884. .replace(/[^\w]/g, '')
  2885. .toLowerCase();
  2886. }
  2887. if (options.rawPrefixHeaderId) {
  2888. title = prefix + title;
  2889. }
  2890. if (globals.hashLinkCounts[title]) {
  2891. title = title + '-' + (globals.hashLinkCounts[title]++);
  2892. } else {
  2893. globals.hashLinkCounts[title] = 1;
  2894. }
  2895. return title;
  2896. }
  2897. text = globals.converter._dispatch('makehtml.headers.after', text, options, globals);
  2898. return text;
  2899. });
  2900. /**
  2901. * Turn Markdown link shortcuts into XHTML <a> tags.
  2902. */
  2903. showdown.subParser('makehtml.horizontalRule', function (text, options, globals) {
  2904. 'use strict';
  2905. text = globals.converter._dispatch('makehtml.horizontalRule.before', text, options, globals);
  2906. var key = showdown.subParser('makehtml.hashBlock')('<hr />', options, globals);
  2907. text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
  2908. text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
  2909. text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
  2910. text = globals.converter._dispatch('makehtml.horizontalRule.after', text, options, globals);
  2911. return text;
  2912. });
  2913. /**
  2914. * Turn Markdown image shortcuts into <img> tags.
  2915. */
  2916. showdown.subParser('makehtml.images', function (text, options, globals) {
  2917. 'use strict';
  2918. text = globals.converter._dispatch('makehtml.images.before', text, options, globals);
  2919. var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
  2920. crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
  2921. base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
  2922. referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
  2923. refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
  2924. function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
  2925. url = url.replace(/\s/g, '');
  2926. return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
  2927. }
  2928. function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
  2929. var gUrls = globals.gUrls,
  2930. gTitles = globals.gTitles,
  2931. gDims = globals.gDimensions;
  2932. linkId = linkId.toLowerCase();
  2933. if (!title) {
  2934. title = '';
  2935. }
  2936. // Special case for explicit empty url
  2937. if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
  2938. url = '';
  2939. } else if (url === '' || url === null) {
  2940. if (linkId === '' || linkId === null) {
  2941. // lower-case and turn embedded newlines into spaces
  2942. linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
  2943. }
  2944. url = '#' + linkId;
  2945. if (!showdown.helper.isUndefined(gUrls[linkId])) {
  2946. url = gUrls[linkId];
  2947. if (!showdown.helper.isUndefined(gTitles[linkId])) {
  2948. title = gTitles[linkId];
  2949. }
  2950. if (!showdown.helper.isUndefined(gDims[linkId])) {
  2951. width = gDims[linkId].width;
  2952. height = gDims[linkId].height;
  2953. }
  2954. } else {
  2955. return wholeMatch;
  2956. }
  2957. }
  2958. altText = altText
  2959. .replace(/"/g, '&quot;')
  2960. //altText = showdown.helper.escapeCharacters(altText, '*_', false);
  2961. .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2962. //url = showdown.helper.escapeCharacters(url, '*_', false);
  2963. url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2964. var result = '<img src="' + url + '" alt="' + altText + '"';
  2965. if (title) {
  2966. title = title
  2967. .replace(/"/g, '&quot;')
  2968. //title = showdown.helper.escapeCharacters(title, '*_', false);
  2969. .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
  2970. result += ' title="' + title + '"';
  2971. }
  2972. if (width && height) {
  2973. width = (width === '*') ? 'auto' : width;
  2974. height = (height === '*') ? 'auto' : height;
  2975. result += ' width="' + width + '"';
  2976. result += ' height="' + height + '"';
  2977. }
  2978. result += ' />';
  2979. return result;
  2980. }
  2981. // First, handle reference-style labeled images: ![alt text][id]
  2982. text = text.replace(referenceRegExp, writeImageTag);
  2983. // Next, handle inline images: ![alt text](url =<width>x<height> "optional title")
  2984. // base64 encoded images
  2985. text = text.replace(base64RegExp, writeImageTagBase64);
  2986. // cases with crazy urls like ./image/cat1).png
  2987. text = text.replace(crazyRegExp, writeImageTag);
  2988. // normal cases
  2989. text = text.replace(inlineRegExp, writeImageTag);
  2990. // handle reference-style shortcuts: ![img text]
  2991. text = text.replace(refShortcutRegExp, writeImageTag);
  2992. text = globals.converter._dispatch('makehtml.images.after', text, options, globals);
  2993. return text;
  2994. });
  2995. showdown.subParser('makehtml.italicsAndBold', function (text, options, globals) {
  2996. 'use strict';
  2997. text = globals.converter._dispatch('makehtml.italicsAndBold.before', text, options, globals);
  2998. // it's faster to have 3 separate regexes for each case than have just one
  2999. // because of backtracing, in some cases, it could lead to an exponential effect
  3000. // called "catastrophic backtrace". Ominous!
  3001. function parseInside (txt, left, right) {
  3002. /*
  3003. if (options.simplifiedAutoLink) {
  3004. txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
  3005. }
  3006. */
  3007. return left + txt + right;
  3008. }
  3009. // Parse underscores
  3010. if (options.literalMidWordUnderscores) {
  3011. text = text.replace(/\b___(\S[\s\S]*)___\b/g, function (wm, txt) {
  3012. return parseInside (txt, '<strong><em>', '</em></strong>');
  3013. });
  3014. text = text.replace(/\b__(\S[\s\S]*)__\b/g, function (wm, txt) {
  3015. return parseInside (txt, '<strong>', '</strong>');
  3016. });
  3017. text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
  3018. return parseInside (txt, '<em>', '</em>');
  3019. });
  3020. } else {
  3021. text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
  3022. return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
  3023. });
  3024. text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
  3025. return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
  3026. });
  3027. text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
  3028. // !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
  3029. return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
  3030. });
  3031. }
  3032. // Now parse asterisks
  3033. if (options.literalMidWordAsterisks) {
  3034. text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]+?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
  3035. return parseInside (txt, lead + '<strong><em>', '</em></strong>');
  3036. });
  3037. text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]+?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
  3038. return parseInside (txt, lead + '<strong>', '</strong>');
  3039. });
  3040. text = text.replace(/([^*]|^)\B\*(\S[\s\S]+?)\*\B(?!\*)/g, function (wm, lead, txt) {
  3041. return parseInside (txt, lead + '<em>', '</em>');
  3042. });
  3043. } else {
  3044. text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
  3045. return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
  3046. });
  3047. text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
  3048. return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
  3049. });
  3050. text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
  3051. // !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
  3052. return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
  3053. });
  3054. }
  3055. text = globals.converter._dispatch('makehtml.italicsAndBold.after', text, options, globals);
  3056. return text;
  3057. });
  3058. /**
  3059. * Form HTML ordered (numbered) and unordered (bulleted) lists.
  3060. */
  3061. showdown.subParser('makehtml.lists', function (text, options, globals) {
  3062. 'use strict';
  3063. /**
  3064. * Process the contents of a single ordered or unordered list, splitting it
  3065. * into individual list items.
  3066. * @param {string} listStr
  3067. * @param {boolean} trimTrailing
  3068. * @returns {string}
  3069. */
  3070. function processListItems (listStr, trimTrailing) {
  3071. // The $g_list_level global keeps track of when we're inside a list.
  3072. // Each time we enter a list, we increment it; when we leave a list,
  3073. // we decrement. If it's zero, we're not in a list anymore.
  3074. //
  3075. // We do this because when we're not inside a list, we want to treat
  3076. // something like this:
  3077. //
  3078. // I recommend upgrading to version
  3079. // 8. Oops, now this line is treated
  3080. // as a sub-list.
  3081. //
  3082. // As a single paragraph, despite the fact that the second line starts
  3083. // with a digit-period-space sequence.
  3084. //
  3085. // Whereas when we're inside a list (or sub-list), that line will be
  3086. // treated as the start of a sub-list. What a kludge, huh? This is
  3087. // an aspect of Markdown's syntax that's hard to parse perfectly
  3088. // without resorting to mind-reading. Perhaps the solution is to
  3089. // change the syntax rules such that sub-lists must start with a
  3090. // starting cardinal number; e.g. "1." or "a.".
  3091. globals.gListLevel++;
  3092. // trim trailing blank lines:
  3093. listStr = listStr.replace(/\n{2,}$/, '\n');
  3094. // attacklab: add sentinel to emulate \z
  3095. listStr += '¨0';
  3096. var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
  3097. isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
  3098. // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
  3099. // which is a syntax breaking change
  3100. // activating this option reverts to old behavior
  3101. if (options.disableForced4SpacesIndentedSublists) {
  3102. rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
  3103. }
  3104. listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
  3105. checked = (checked && checked.trim() !== '');
  3106. var item = showdown.subParser('makehtml.outdent')(m4, options, globals),
  3107. bulletStyle = '';
  3108. // Support for github tasklists
  3109. if (taskbtn && options.tasklists) {
  3110. bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
  3111. item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
  3112. var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
  3113. if (checked) {
  3114. otp += ' checked';
  3115. }
  3116. otp += '>';
  3117. return otp;
  3118. });
  3119. }
  3120. // ISSUE #312
  3121. // This input: - - - a
  3122. // causes trouble to the parser, since it interprets it as:
  3123. // <ul><li><li><li>a</li></li></li></ul>
  3124. // instead of:
  3125. // <ul><li>- - a</li></ul>
  3126. // So, to prevent it, we will put a marker (¨A)in the beginning of the line
  3127. // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
  3128. item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
  3129. return '¨A' + wm2;
  3130. });
  3131. // m1 - Leading line or
  3132. // Has a double return (multi paragraph) or
  3133. // Has sublist
  3134. if (m1 || (item.search(/\n{2,}/) > -1)) {
  3135. item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
  3136. item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
  3137. } else {
  3138. // Recursion for sub-lists:
  3139. item = showdown.subParser('makehtml.lists')(item, options, globals);
  3140. item = item.replace(/\n$/, ''); // chomp(item)
  3141. item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
  3142. // Colapse double linebreaks
  3143. item = item.replace(/\n\n+/g, '\n\n');
  3144. if (isParagraphed) {
  3145. item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
  3146. } else {
  3147. item = showdown.subParser('makehtml.spanGamut')(item, options, globals);
  3148. }
  3149. }
  3150. // now we need to remove the marker (¨A)
  3151. item = item.replace('¨A', '');
  3152. // we can finally wrap the line in list item tags
  3153. item = '<li' + bulletStyle + '>' + item + '</li>\n';
  3154. return item;
  3155. });
  3156. // attacklab: strip sentinel
  3157. listStr = listStr.replace(/¨0/g, '');
  3158. globals.gListLevel--;
  3159. if (trimTrailing) {
  3160. listStr = listStr.replace(/\s+$/, '');
  3161. }
  3162. return listStr;
  3163. }
  3164. function styleStartNumber (list, listType) {
  3165. // check if ol and starts by a number different than 1
  3166. if (listType === 'ol') {
  3167. var res = list.match(/^ *(\d+)\./);
  3168. if (res && res[1] !== '1') {
  3169. return ' start="' + res[1] + '"';
  3170. }
  3171. }
  3172. return '';
  3173. }
  3174. /**
  3175. * Check and parse consecutive lists (better fix for issue #142)
  3176. * @param {string} list
  3177. * @param {string} listType
  3178. * @param {boolean} trimTrailing
  3179. * @returns {string}
  3180. */
  3181. function parseConsecutiveLists (list, listType, trimTrailing) {
  3182. // check if we caught 2 or more consecutive lists by mistake
  3183. // we use the counterRgx, meaning if listType is UL we look for OL and vice versa
  3184. var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
  3185. ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
  3186. counterRxg = (listType === 'ul') ? olRgx : ulRgx,
  3187. result = '';
  3188. if (list.search(counterRxg) !== -1) {
  3189. (function parseCL (txt) {
  3190. var pos = txt.search(counterRxg),
  3191. style = styleStartNumber(list, listType);
  3192. if (pos !== -1) {
  3193. // slice
  3194. result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
  3195. // invert counterType and listType
  3196. listType = (listType === 'ul') ? 'ol' : 'ul';
  3197. counterRxg = (listType === 'ul') ? olRgx : ulRgx;
  3198. //recurse
  3199. parseCL(txt.slice(pos));
  3200. } else {
  3201. result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
  3202. }
  3203. })(list);
  3204. } else {
  3205. var style = styleStartNumber(list, listType);
  3206. result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
  3207. }
  3208. return result;
  3209. }
  3210. /** Start of list parsing **/
  3211. text = globals.converter._dispatch('lists.before', text, options, globals);
  3212. // add sentinel to hack around khtml/safari bug:
  3213. // http://bugs.webkit.org/show_bug.cgi?id=11231
  3214. text += '¨0';
  3215. if (globals.gListLevel) {
  3216. text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
  3217. function (wholeMatch, list, m2) {
  3218. var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
  3219. return parseConsecutiveLists(list, listType, true);
  3220. }
  3221. );
  3222. } else {
  3223. text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
  3224. function (wholeMatch, m1, list, m3) {
  3225. var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
  3226. return parseConsecutiveLists(list, listType, false);
  3227. }
  3228. );
  3229. }
  3230. // strip sentinel
  3231. text = text.replace(/¨0/, '');
  3232. text = globals.converter._dispatch('makehtml.lists.after', text, options, globals);
  3233. return text;
  3234. });
  3235. /**
  3236. * Parse metadata at the top of the document
  3237. */
  3238. showdown.subParser('makehtml.metadata', function (text, options, globals) {
  3239. 'use strict';
  3240. if (!options.metadata) {
  3241. return text;
  3242. }
  3243. text = globals.converter._dispatch('makehtml.metadata.before', text, options, globals);
  3244. function parseMetadataContents (content) {
  3245. // raw is raw so it's not changed in any way
  3246. globals.metadata.raw = content;
  3247. // escape chars forbidden in html attributes
  3248. // double quotes
  3249. content = content
  3250. // ampersand first
  3251. .replace(/&/g, '&amp;')
  3252. // double quotes
  3253. .replace(/"/g, '&quot;');
  3254. content = content.replace(/\n {4}/g, ' ');
  3255. content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
  3256. globals.metadata.parsed[key] = value;
  3257. return '';
  3258. });
  3259. }
  3260. text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
  3261. parseMetadataContents(content);
  3262. return '¨M';
  3263. });
  3264. text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
  3265. if (format) {
  3266. globals.metadata.format = format;
  3267. }
  3268. parseMetadataContents(content);
  3269. return '¨M';
  3270. });
  3271. text = text.replace(/¨M/g, '');
  3272. text = globals.converter._dispatch('makehtml.metadata.after', text, options, globals);
  3273. return text;
  3274. });
  3275. /**
  3276. * Remove one level of line-leading tabs or spaces
  3277. */
  3278. showdown.subParser('makehtml.outdent', function (text, options, globals) {
  3279. 'use strict';
  3280. text = globals.converter._dispatch('makehtml.outdent.before', text, options, globals);
  3281. // attacklab: hack around Konqueror 3.5.4 bug:
  3282. // "----------bug".replace(/^-/g,"") == "bug"
  3283. text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width
  3284. // attacklab: clean up hack
  3285. text = text.replace(/¨0/g, '');
  3286. text = globals.converter._dispatch('makehtml.outdent.after', text, options, globals);
  3287. return text;
  3288. });
  3289. /**
  3290. *
  3291. */
  3292. showdown.subParser('makehtml.paragraphs', function (text, options, globals) {
  3293. 'use strict';
  3294. text = globals.converter._dispatch('makehtml.paragraphs.before', text, options, globals);
  3295. // Strip leading and trailing lines:
  3296. text = text.replace(/^\n+/g, '');
  3297. text = text.replace(/\n+$/g, '');
  3298. var grafs = text.split(/\n{2,}/g),
  3299. grafsOut = [],
  3300. end = grafs.length; // Wrap <p> tags
  3301. for (var i = 0; i < end; i++) {
  3302. var str = grafs[i];
  3303. // if this is an HTML marker, copy it
  3304. if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
  3305. grafsOut.push(str);
  3306. // test for presence of characters to prevent empty lines being parsed
  3307. // as paragraphs (resulting in undesired extra empty paragraphs)
  3308. } else if (str.search(/\S/) >= 0) {
  3309. str = showdown.subParser('makehtml.spanGamut')(str, options, globals);
  3310. str = str.replace(/^([ \t]*)/g, '<p>');
  3311. str += '</p>';
  3312. grafsOut.push(str);
  3313. }
  3314. }
  3315. /** Unhashify HTML blocks */
  3316. end = grafsOut.length;
  3317. for (i = 0; i < end; i++) {
  3318. var blockText = '',
  3319. grafsOutIt = grafsOut[i],
  3320. codeFlag = false;
  3321. // if this is a marker for an html block...
  3322. // use RegExp.test instead of string.search because of QML bug
  3323. while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
  3324. var delim = RegExp.$1,
  3325. num = RegExp.$2;
  3326. if (delim === 'K') {
  3327. blockText = globals.gHtmlBlocks[num];
  3328. } else {
  3329. // we need to check if ghBlock is a false positive
  3330. if (codeFlag) {
  3331. // use encoded version of all text
  3332. blockText = showdown.subParser('makehtml.encodeCode')(globals.ghCodeBlocks[num].text, options, globals);
  3333. } else {
  3334. blockText = globals.ghCodeBlocks[num].codeblock;
  3335. }
  3336. }
  3337. blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
  3338. grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
  3339. // Check if grafsOutIt is a pre->code
  3340. if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
  3341. codeFlag = true;
  3342. }
  3343. }
  3344. grafsOut[i] = grafsOutIt;
  3345. }
  3346. text = grafsOut.join('\n');
  3347. // Strip leading and trailing lines:
  3348. text = text.replace(/^\n+/g, '');
  3349. text = text.replace(/\n+$/g, '');
  3350. return globals.converter._dispatch('makehtml.paragraphs.after', text, options, globals);
  3351. });
  3352. /**
  3353. * Run extension
  3354. */
  3355. showdown.subParser('makehtml.runExtension', function (ext, text, options, globals) {
  3356. 'use strict';
  3357. if (ext.filter) {
  3358. text = ext.filter(text, globals.converter, options);
  3359. } else if (ext.regex) {
  3360. // TODO remove this when old extension loading mechanism is deprecated
  3361. var re = ext.regex;
  3362. if (!(re instanceof RegExp)) {
  3363. re = new RegExp(re, 'g');
  3364. }
  3365. text = text.replace(re, ext.replace);
  3366. }
  3367. return text;
  3368. });
  3369. /**
  3370. * These are all the transformations that occur *within* block-level
  3371. * tags like paragraphs, headers, and list items.
  3372. */
  3373. showdown.subParser('makehtml.spanGamut', function (text, options, globals) {
  3374. 'use strict';
  3375. text = globals.converter._dispatch('smakehtml.panGamut.before', text, options, globals);
  3376. text = showdown.subParser('makehtml.codeSpans')(text, options, globals);
  3377. text = showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes')(text, options, globals);
  3378. text = showdown.subParser('makehtml.encodeBackslashEscapes')(text, options, globals);
  3379. // Process anchor and image tags. Images must come first,
  3380. // because ![foo][f] looks like an anchor.
  3381. text = showdown.subParser('makehtml.images')(text, options, globals);
  3382. text = showdown.subParser('makehtml.anchors')(text, options, globals);
  3383. // Make links out of things like `<http://example.com/>`
  3384. // Must come after anchors, because you can use < and >
  3385. // delimiters in inline links like [this](<url>).
  3386. text = showdown.subParser('makehtml.autoLinks')(text, options, globals);
  3387. text = showdown.subParser('makehtml.simplifiedAutoLinks')(text, options, globals);
  3388. text = showdown.subParser('makehtml.emoji')(text, options, globals);
  3389. text = showdown.subParser('makehtml.underline')(text, options, globals);
  3390. text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals);
  3391. text = showdown.subParser('makehtml.strikethrough')(text, options, globals);
  3392. text = showdown.subParser('makehtml.ellipsis')(text, options, globals);
  3393. // we need to hash HTML tags inside spans
  3394. text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals);
  3395. // now we encode amps and angles
  3396. text = showdown.subParser('makehtml.encodeAmpsAndAngles')(text, options, globals);
  3397. // Do hard breaks
  3398. if (options.simpleLineBreaks) {
  3399. // GFM style hard breaks
  3400. // only add line breaks if the text does not contain a block (special case for lists)
  3401. if (!/\n\n¨K/.test(text)) {
  3402. text = text.replace(/\n+/g, '<br />\n');
  3403. }
  3404. } else {
  3405. // Vanilla hard breaks
  3406. text = text.replace(/ +\n/g, '<br />\n');
  3407. }
  3408. text = globals.converter._dispatch('makehtml.spanGamut.after', text, options, globals);
  3409. return text;
  3410. });
  3411. showdown.subParser('makehtml.strikethrough', function (text, options, globals) {
  3412. 'use strict';
  3413. function parseInside (txt) {
  3414. if (options.simplifiedAutoLink) {
  3415. txt = showdown.subParser('makehtml.simplifiedAutoLinks')(txt, options, globals);
  3416. }
  3417. return '<del>' + txt + '</del>';
  3418. }
  3419. if (options.strikethrough) {
  3420. text = globals.converter._dispatch('makehtml.strikethrough.before', text, options, globals);
  3421. text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
  3422. text = globals.converter._dispatch('makehtml.strikethrough.after', text, options, globals);
  3423. }
  3424. return text;
  3425. });
  3426. /**
  3427. * Strips link definitions from text, stores the URLs and titles in
  3428. * hash references.
  3429. * Link defs are in the form: ^[id]: url "optional title"
  3430. */
  3431. showdown.subParser('makehtml.stripLinkDefinitions', function (text, options, globals) {
  3432. 'use strict';
  3433. var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
  3434. base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
  3435. // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
  3436. text += '¨0';
  3437. var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
  3438. linkId = linkId.toLowerCase();
  3439. if (url.match(/^data:.+?\/.+?;base64,/)) {
  3440. // remove newlines
  3441. globals.gUrls[linkId] = url.replace(/\s/g, '');
  3442. } else {
  3443. globals.gUrls[linkId] = showdown.subParser('makehtml.encodeAmpsAndAngles')(url, options, globals); // Link IDs are case-insensitive
  3444. }
  3445. if (blankLines) {
  3446. // Oops, found blank lines, so it's not a title.
  3447. // Put back the parenthetical statement we stole.
  3448. return blankLines + title;
  3449. } else {
  3450. if (title) {
  3451. globals.gTitles[linkId] = title.replace(/"|'/g, '&quot;');
  3452. }
  3453. if (options.parseImgDimensions && width && height) {
  3454. globals.gDimensions[linkId] = {
  3455. width: width,
  3456. height: height
  3457. };
  3458. }
  3459. }
  3460. // Completely remove the definition from the text
  3461. return '';
  3462. };
  3463. // first we try to find base64 link references
  3464. text = text.replace(base64Regex, replaceFunc);
  3465. text = text.replace(regex, replaceFunc);
  3466. // attacklab: strip sentinel
  3467. text = text.replace(/¨0/, '');
  3468. return text;
  3469. });
  3470. showdown.subParser('makehtml.tables', function (text, options, globals) {
  3471. 'use strict';
  3472. if (!options.tables) {
  3473. return text;
  3474. }
  3475. var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
  3476. //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
  3477. singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
  3478. function parseStyles (sLine) {
  3479. if (/^:[ \t]*--*$/.test(sLine)) {
  3480. return ' style="text-align:left;"';
  3481. } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
  3482. return ' style="text-align:right;"';
  3483. } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
  3484. return ' style="text-align:center;"';
  3485. } else {
  3486. return '';
  3487. }
  3488. }
  3489. function parseHeaders (header, style) {
  3490. var id = '';
  3491. header = header.trim();
  3492. // support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility
  3493. if (options.tablesHeaderId || options.tableHeaderId) {
  3494. id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
  3495. }
  3496. header = showdown.subParser('makehtml.spanGamut')(header, options, globals);
  3497. return '<th' + id + style + '>' + header + '</th>\n';
  3498. }
  3499. function parseCells (cell, style) {
  3500. var subText = showdown.subParser('makehtml.spanGamut')(cell, options, globals);
  3501. return '<td' + style + '>' + subText + '</td>\n';
  3502. }
  3503. function buildTable (headers, cells) {
  3504. var tb = '<table>\n<thead>\n<tr>\n',
  3505. tblLgn = headers.length;
  3506. for (var i = 0; i < tblLgn; ++i) {
  3507. tb += headers[i];
  3508. }
  3509. tb += '</tr>\n</thead>\n<tbody>\n';
  3510. for (i = 0; i < cells.length; ++i) {
  3511. tb += '<tr>\n';
  3512. for (var ii = 0; ii < tblLgn; ++ii) {
  3513. tb += cells[i][ii];
  3514. }
  3515. tb += '</tr>\n';
  3516. }
  3517. tb += '</tbody>\n</table>\n';
  3518. return tb;
  3519. }
  3520. function parseTable (rawTable) {
  3521. var i, tableLines = rawTable.split('\n');
  3522. for (i = 0; i < tableLines.length; ++i) {
  3523. // strip wrong first and last column if wrapped tables are used
  3524. if (/^ {0,3}\|/.test(tableLines[i])) {
  3525. tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
  3526. }
  3527. if (/\|[ \t]*$/.test(tableLines[i])) {
  3528. tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
  3529. }
  3530. // parse code spans first, but we only support one line code spans
  3531. tableLines[i] = showdown.subParser('makehtml.codeSpans')(tableLines[i], options, globals);
  3532. }
  3533. var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
  3534. rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
  3535. rawCells = [],
  3536. headers = [],
  3537. styles = [],
  3538. cells = [];
  3539. tableLines.shift();
  3540. tableLines.shift();
  3541. for (i = 0; i < tableLines.length; ++i) {
  3542. if (tableLines[i].trim() === '') {
  3543. continue;
  3544. }
  3545. rawCells.push(
  3546. tableLines[i]
  3547. .split('|')
  3548. .map(function (s) {
  3549. return s.trim();
  3550. })
  3551. );
  3552. }
  3553. if (rawHeaders.length < rawStyles.length) {
  3554. return rawTable;
  3555. }
  3556. for (i = 0; i < rawStyles.length; ++i) {
  3557. styles.push(parseStyles(rawStyles[i]));
  3558. }
  3559. for (i = 0; i < rawHeaders.length; ++i) {
  3560. if (showdown.helper.isUndefined(styles[i])) {
  3561. styles[i] = '';
  3562. }
  3563. headers.push(parseHeaders(rawHeaders[i], styles[i]));
  3564. }
  3565. for (i = 0; i < rawCells.length; ++i) {
  3566. var row = [];
  3567. for (var ii = 0; ii < headers.length; ++ii) {
  3568. if (showdown.helper.isUndefined(rawCells[i][ii])) {
  3569. }
  3570. row.push(parseCells(rawCells[i][ii], styles[ii]));
  3571. }
  3572. cells.push(row);
  3573. }
  3574. return buildTable(headers, cells);
  3575. }
  3576. text = globals.converter._dispatch('makehtml.tables.before', text, options, globals);
  3577. // find escaped pipe characters
  3578. text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
  3579. // parse multi column tables
  3580. text = text.replace(tableRgx, parseTable);
  3581. // parse one column tables
  3582. text = text.replace(singeColTblRgx, parseTable);
  3583. text = globals.converter._dispatch('makehtml.tables.after', text, options, globals);
  3584. return text;
  3585. });
  3586. showdown.subParser('makehtml.underline', function (text, options, globals) {
  3587. 'use strict';
  3588. if (!options.underline) {
  3589. return text;
  3590. }
  3591. text = globals.converter._dispatch('makehtml.underline.before', text, options, globals);
  3592. if (options.literalMidWordUnderscores) {
  3593. text = text.replace(/\b_?__(\S[\s\S]*)___?\b/g, function (wm, txt) {
  3594. return '<u>' + txt + '</u>';
  3595. });
  3596. } else {
  3597. text = text.replace(/_?__(\S[\s\S]*?)___?/g, function (wm, m) {
  3598. return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
  3599. });
  3600. }
  3601. // escape remaining underscores to prevent them being parsed by italic and bold
  3602. text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
  3603. text = globals.converter._dispatch('makehtml.underline.after', text, options, globals);
  3604. return text;
  3605. });
  3606. /**
  3607. * Swap back in all the special characters we've hidden.
  3608. */
  3609. showdown.subParser('makehtml.unescapeSpecialChars', function (text, options, globals) {
  3610. 'use strict';
  3611. text = globals.converter._dispatch('makehtml.unescapeSpecialChars.before', text, options, globals);
  3612. text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
  3613. var charCodeToReplace = parseInt(m1);
  3614. return String.fromCharCode(charCodeToReplace);
  3615. });
  3616. text = globals.converter._dispatch('makehtml.unescapeSpecialChars.after', text, options, globals);
  3617. return text;
  3618. });
  3619. /**
  3620. * Created by Estevao on 31-05-2015.
  3621. */
  3622. /**
  3623. * Showdown Converter class
  3624. * @class
  3625. * @param {object} [converterOptions]
  3626. * @returns {Converter}
  3627. */
  3628. showdown.Converter = function (converterOptions) {
  3629. 'use strict';
  3630. var
  3631. /**
  3632. * Options used by this converter
  3633. * @private
  3634. * @type {{}}
  3635. */
  3636. options = {},
  3637. /**
  3638. * Language extensions used by this converter
  3639. * @private
  3640. * @type {Array}
  3641. */
  3642. langExtensions = [],
  3643. /**
  3644. * Output modifiers extensions used by this converter
  3645. * @private
  3646. * @type {Array}
  3647. */
  3648. outputModifiers = [],
  3649. /**
  3650. * Event listeners
  3651. * @private
  3652. * @type {{}}
  3653. */
  3654. listeners = {},
  3655. /**
  3656. * The flavor set in this converter
  3657. */
  3658. setConvFlavor = setFlavor,
  3659. /**
  3660. * Metadata of the document
  3661. * @type {{parsed: {}, raw: string, format: string}}
  3662. */
  3663. metadata = {
  3664. parsed: {},
  3665. raw: '',
  3666. format: ''
  3667. };
  3668. _constructor();
  3669. /**
  3670. * Converter constructor
  3671. * @private
  3672. */
  3673. function _constructor () {
  3674. converterOptions = converterOptions || {};
  3675. for (var gOpt in globalOptions) {
  3676. if (globalOptions.hasOwnProperty(gOpt)) {
  3677. options[gOpt] = globalOptions[gOpt];
  3678. }
  3679. }
  3680. // Merge options
  3681. if (typeof converterOptions === 'object') {
  3682. for (var opt in converterOptions) {
  3683. if (converterOptions.hasOwnProperty(opt)) {
  3684. options[opt] = converterOptions[opt];
  3685. }
  3686. }
  3687. } else {
  3688. throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
  3689. ' was passed instead.');
  3690. }
  3691. if (options.extensions) {
  3692. showdown.helper.forEach(options.extensions, _parseExtension);
  3693. }
  3694. }
  3695. /**
  3696. * Parse extension
  3697. * @param {*} ext
  3698. * @param {string} [name='']
  3699. * @private
  3700. */
  3701. function _parseExtension (ext, name) {
  3702. name = name || null;
  3703. // If it's a string, the extension was previously loaded
  3704. if (showdown.helper.isString(ext)) {
  3705. ext = showdown.helper.stdExtName(ext);
  3706. name = ext;
  3707. // LEGACY_SUPPORT CODE
  3708. if (showdown.extensions[ext]) {
  3709. console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
  3710. 'Please inform the developer that the extension should be updated!');
  3711. legacyExtensionLoading(showdown.extensions[ext], ext);
  3712. return;
  3713. // END LEGACY SUPPORT CODE
  3714. } else if (!showdown.helper.isUndefined(extensions[ext])) {
  3715. ext = extensions[ext];
  3716. } else {
  3717. throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
  3718. }
  3719. }
  3720. if (typeof ext === 'function') {
  3721. ext = ext();
  3722. }
  3723. if (!showdown.helper.isArray(ext)) {
  3724. ext = [ext];
  3725. }
  3726. var validExt = validate(ext, name);
  3727. if (!validExt.valid) {
  3728. throw Error(validExt.error);
  3729. }
  3730. for (var i = 0; i < ext.length; ++i) {
  3731. switch (ext[i].type) {
  3732. case 'lang':
  3733. langExtensions.push(ext[i]);
  3734. break;
  3735. case 'output':
  3736. outputModifiers.push(ext[i]);
  3737. break;
  3738. }
  3739. if (ext[i].hasOwnProperty('listeners')) {
  3740. for (var ln in ext[i].listeners) {
  3741. if (ext[i].listeners.hasOwnProperty(ln)) {
  3742. listen(ln, ext[i].listeners[ln]);
  3743. }
  3744. }
  3745. }
  3746. }
  3747. }
  3748. /**
  3749. * LEGACY_SUPPORT
  3750. * @param {*} ext
  3751. * @param {string} name
  3752. */
  3753. function legacyExtensionLoading (ext, name) {
  3754. if (typeof ext === 'function') {
  3755. ext = ext(new showdown.Converter());
  3756. }
  3757. if (!showdown.helper.isArray(ext)) {
  3758. ext = [ext];
  3759. }
  3760. var valid = validate(ext, name);
  3761. if (!valid.valid) {
  3762. throw Error(valid.error);
  3763. }
  3764. for (var i = 0; i < ext.length; ++i) {
  3765. switch (ext[i].type) {
  3766. case 'lang':
  3767. langExtensions.push(ext[i]);
  3768. break;
  3769. case 'output':
  3770. outputModifiers.push(ext[i]);
  3771. break;
  3772. default:// should never reach here
  3773. throw Error('Extension loader error: Type unrecognized!!!');
  3774. }
  3775. }
  3776. }
  3777. /**
  3778. * Listen to an event
  3779. * @param {string} name
  3780. * @param {function} callback
  3781. */
  3782. function listen (name, callback) {
  3783. if (!showdown.helper.isString(name)) {
  3784. throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
  3785. }
  3786. if (typeof callback !== 'function') {
  3787. throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
  3788. }
  3789. if (!listeners.hasOwnProperty(name)) {
  3790. listeners[name] = [];
  3791. }
  3792. listeners[name].push(callback);
  3793. }
  3794. function rTrimInputText (text) {
  3795. var rsp = text.match(/^\s*/)[0].length,
  3796. rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
  3797. return text.replace(rgx, '');
  3798. }
  3799. /**
  3800. * Dispatch an event
  3801. * @private
  3802. * @param {string} evtName Event name
  3803. * @param {string} text Text
  3804. * @param {{}} options Converter Options
  3805. * @param {{}} globals
  3806. * @returns {string}
  3807. */
  3808. this._dispatch = function dispatch (evtName, text, options, globals) {
  3809. if (listeners.hasOwnProperty(evtName)) {
  3810. for (var ei = 0; ei < listeners[evtName].length; ++ei) {
  3811. var nText = listeners[evtName][ei](evtName, text, this, options, globals);
  3812. if (nText && typeof nText !== 'undefined') {
  3813. text = nText;
  3814. }
  3815. }
  3816. }
  3817. return text;
  3818. };
  3819. /**
  3820. * Listen to an event
  3821. * @param {string} name
  3822. * @param {function} callback
  3823. * @returns {showdown.Converter}
  3824. */
  3825. this.listen = function (name, callback) {
  3826. listen(name, callback);
  3827. return this;
  3828. };
  3829. /**
  3830. * Converts a markdown string into HTML string
  3831. * @param {string} text
  3832. * @returns {*}
  3833. */
  3834. this.makeHtml = function (text) {
  3835. //check if text is not falsy
  3836. if (!text) {
  3837. return text;
  3838. }
  3839. var globals = {
  3840. gHtmlBlocks: [],
  3841. gHtmlMdBlocks: [],
  3842. gHtmlSpans: [],
  3843. gUrls: {},
  3844. gTitles: {},
  3845. gDimensions: {},
  3846. gListLevel: 0,
  3847. hashLinkCounts: {},
  3848. langExtensions: langExtensions,
  3849. outputModifiers: outputModifiers,
  3850. converter: this,
  3851. ghCodeBlocks: [],
  3852. metadata: {
  3853. parsed: {},
  3854. raw: '',
  3855. format: ''
  3856. }
  3857. };
  3858. // This lets us use ¨ trema as an escape char to avoid md5 hashes
  3859. // The choice of character is arbitrary; anything that isn't
  3860. // magic in Markdown will work.
  3861. text = text.replace(/¨/g, '¨T');
  3862. // Replace $ with ¨D
  3863. // RegExp interprets $ as a special character
  3864. // when it's in a replacement string
  3865. text = text.replace(/\$/g, '¨D');
  3866. // Standardize line endings
  3867. text = text.replace(/\r\n/g, '\n'); // DOS to Unix
  3868. text = text.replace(/\r/g, '\n'); // Mac to Unix
  3869. // Stardardize line spaces (nbsp causes trouble in older browsers and some regex flavors)
  3870. text = text.replace(/\u00A0/g, ' ');
  3871. if (options.smartIndentationFix) {
  3872. text = rTrimInputText(text);
  3873. }
  3874. // Make sure text begins and ends with a couple of newlines:
  3875. text = '\n\n' + text + '\n\n';
  3876. // detab
  3877. text = showdown.subParser('makehtml.detab')(text, options, globals);
  3878. /**
  3879. * Strip any lines consisting only of spaces and tabs.
  3880. * This makes subsequent regexs easier to write, because we can
  3881. * match consecutive blank lines with /\n+/ instead of something
  3882. * contorted like /[ \t]*\n+/
  3883. */
  3884. text = text.replace(/^[ \t]+$/mg, '');
  3885. //run languageExtensions
  3886. showdown.helper.forEach(langExtensions, function (ext) {
  3887. text = showdown.subParser('makehtml.runExtension')(ext, text, options, globals);
  3888. });
  3889. // run the sub parsers
  3890. text = showdown.subParser('makehtml.metadata')(text, options, globals);
  3891. text = showdown.subParser('makehtml.hashPreCodeTags')(text, options, globals);
  3892. text = showdown.subParser('makehtml.githubCodeBlocks')(text, options, globals);
  3893. text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
  3894. text = showdown.subParser('makehtml.hashCodeTags')(text, options, globals);
  3895. text = showdown.subParser('makehtml.stripLinkDefinitions')(text, options, globals);
  3896. text = showdown.subParser('makehtml.blockGamut')(text, options, globals);
  3897. text = showdown.subParser('makehtml.unhashHTMLSpans')(text, options, globals);
  3898. text = showdown.subParser('makehtml.unescapeSpecialChars')(text, options, globals);
  3899. // attacklab: Restore dollar signs
  3900. text = text.replace(/¨D/g, '$$');
  3901. // attacklab: Restore tremas
  3902. text = text.replace(/¨T/g, '¨');
  3903. // render a complete html document instead of a partial if the option is enabled
  3904. text = showdown.subParser('makehtml.completeHTMLDocument')(text, options, globals);
  3905. // Run output modifiers
  3906. showdown.helper.forEach(outputModifiers, function (ext) {
  3907. text = showdown.subParser('makehtml.runExtension')(ext, text, options, globals);
  3908. });
  3909. // update metadata
  3910. metadata = globals.metadata;
  3911. return text;
  3912. };
  3913. /**
  3914. * Converts an HTML string into a markdown string
  3915. * @param src
  3916. * @returns {string}
  3917. */
  3918. this.makeMarkdown = function (src) {
  3919. // replace \r\n with \n
  3920. src = src.replace(/\r\n/g, '\n');
  3921. src = src.replace(/\r/g, '\n'); // old macs
  3922. // due to an edge case, we need to find this: > <
  3923. // to prevent removing of non silent white spaces
  3924. // ex: <em>this is</em> <strong>sparta</strong>
  3925. src = src.replace(/>[ \t]+</, '>¨NBSP;<');
  3926. var doc = showdown.helper.document.createElement('div');
  3927. doc.innerHTML = src;
  3928. var preList = substitutePreCodeTags(doc);
  3929. // remove all newlines and collapse spaces
  3930. clean(doc);
  3931. // some stuff, like accidental reference links must now be escaped
  3932. // TODO
  3933. // doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
  3934. var nodes = doc.childNodes,
  3935. mdDoc = '';
  3936. for (var i = 0; i < nodes.length; i++) {
  3937. mdDoc += parseNode(nodes[i]);
  3938. }
  3939. function parseNode (node, spansOnly) {
  3940. spansOnly = spansOnly || false;
  3941. var txt = '';
  3942. // edge case of text without wrapper paragraph
  3943. if (node.nodeType === 3) {
  3944. return parseTxt(node);
  3945. }
  3946. // HTML comment
  3947. if (node.nodeType === 8) {
  3948. return '<!--' + node.data + '-->\n\n';
  3949. }
  3950. // process only node elements
  3951. if (node.nodeType !== 1) {
  3952. return '';
  3953. }
  3954. var tagName = node.tagName.toLowerCase();
  3955. switch (tagName) {
  3956. //
  3957. // BLOCKS
  3958. //
  3959. case 'h1':
  3960. if (!spansOnly) { txt = parseHeader(node, 1) + '\n\n'; }
  3961. break;
  3962. case 'h2':
  3963. if (!spansOnly) { txt = parseHeader(node, 2) + '\n\n'; }
  3964. break;
  3965. case 'h3':
  3966. if (!spansOnly) { txt = parseHeader(node, 3) + '\n\n'; }
  3967. break;
  3968. case 'h4':
  3969. if (!spansOnly) { txt = parseHeader(node, 4) + '\n\n'; }
  3970. break;
  3971. case 'h5':
  3972. if (!spansOnly) { txt = parseHeader(node, 5) + '\n\n'; }
  3973. break;
  3974. case 'h6':
  3975. if (!spansOnly) { txt = parseHeader(node, 6) + '\n\n'; }
  3976. break;
  3977. case 'p':
  3978. if (!spansOnly) { txt = parseParagraph(node) + '\n\n'; }
  3979. break;
  3980. case 'blockquote':
  3981. if (!spansOnly) { txt = parseBlockquote(node) + '\n\n'; }
  3982. break;
  3983. case 'hr':
  3984. if (!spansOnly) { txt = parseHr(node) + '\n\n'; }
  3985. break;
  3986. case 'ol':
  3987. if (!spansOnly) { txt = parseList(node, 'ol') + '\n\n'; }
  3988. break;
  3989. case 'ul':
  3990. if (!spansOnly) { txt = parseList(node, 'ul') + '\n\n'; }
  3991. break;
  3992. case 'precode':
  3993. if (!spansOnly) { txt = parsePreCode(node) + '\n\n'; }
  3994. break;
  3995. case 'pre':
  3996. if (!spansOnly) { txt = parsePre(node) + '\n\n'; }
  3997. break;
  3998. case 'table':
  3999. if (!spansOnly) { txt = parseTable(node) + '\n\n'; }
  4000. break;
  4001. //
  4002. // SPANS
  4003. //
  4004. case 'code':
  4005. txt = parseCodeSpan(node);
  4006. break;
  4007. case 'em':
  4008. case 'i':
  4009. txt = parseEmphasis(node);
  4010. break;
  4011. case 'strong':
  4012. case 'b':
  4013. txt = parseStrong(node);
  4014. break;
  4015. case 'del':
  4016. txt = parseDel(node);
  4017. break;
  4018. case 'a':
  4019. txt = parseLinks(node);
  4020. break;
  4021. case 'img':
  4022. txt = parseImage(node);
  4023. break;
  4024. default:
  4025. txt = node.outerHTML + '\n\n';
  4026. }
  4027. // common normalization
  4028. return txt;
  4029. }
  4030. function parseTxt (node) {
  4031. var txt = node.nodeValue;
  4032. // multiple spaces are collapsed
  4033. txt = txt.replace(/ +/g, ' ');
  4034. // replace the custom ¨NBSP; with a space
  4035. txt = txt.replace(/¨NBSP;/g, ' ');
  4036. // ", <, > and & should replace escaped html entities
  4037. txt = showdown.helper.unescapeHTMLEntities(txt);
  4038. // escape markdown magic characters
  4039. // emphasis, strong and strikethrough - can appear everywhere
  4040. // we also escape pipe (|) because of tables
  4041. // and escape ` because of code blocks and spans
  4042. txt = txt.replace(/([*_~|`])/g, '\\$1');
  4043. // escape > because of blockquotes
  4044. txt = txt.replace(/^(\s*)>/g, '\\$1>');
  4045. // hash character, only troublesome at the beginning of a line because of headers
  4046. txt = txt.replace(/^#/gm, '\\#');
  4047. // horizontal rules
  4048. txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3');
  4049. // dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer
  4050. txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.');
  4051. // +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped)
  4052. txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2');
  4053. // images and links, ] followed by ( is problematic, so we escape it
  4054. txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\(');
  4055. // reference URIs must also be escaped
  4056. txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:');
  4057. return txt;
  4058. }
  4059. function parseList (node, type) {
  4060. var txt = '';
  4061. if (!node.hasChildNodes()) {
  4062. return '';
  4063. }
  4064. var listItems = node.childNodes,
  4065. listItemsLenght = listItems.length,
  4066. listNum = node.getAttribute('start') || 1;
  4067. for (var i = 0; i < listItemsLenght; ++i) {
  4068. if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') {
  4069. continue;
  4070. }
  4071. // define the bullet to use in list
  4072. var bullet = '';
  4073. if (type === 'ol') {
  4074. bullet = listNum.toString() + '. ';
  4075. } else {
  4076. bullet = '- ';
  4077. }
  4078. // parse list item
  4079. txt += bullet + parseListItem(listItems[i]);
  4080. ++listNum;
  4081. }
  4082. return txt.trim();
  4083. }
  4084. function parseListItem (node) {
  4085. var listItemTxt = '';
  4086. var children = node.childNodes,
  4087. childrenLenght = children.length;
  4088. for (var i = 0; i < childrenLenght; ++i) {
  4089. listItemTxt += parseNode(children[i]);
  4090. }
  4091. // if it's only one liner, we need to add a newline at the end
  4092. if (!/\n$/.test(listItemTxt)) {
  4093. listItemTxt += '\n';
  4094. } else {
  4095. // it's multiparagraph, so we need to indent
  4096. listItemTxt = listItemTxt
  4097. .split('\n')
  4098. .join('\n ')
  4099. .replace(/^ {4}$/gm, '')
  4100. .replace(/\n\n+/g, '\n\n');
  4101. }
  4102. return listItemTxt;
  4103. }
  4104. function parseHr () {
  4105. return '---';
  4106. }
  4107. function parseBlockquote (node) {
  4108. var txt = '';
  4109. if (node.hasChildNodes()) {
  4110. var children = node.childNodes,
  4111. childrenLength = children.length;
  4112. for (var i = 0; i < childrenLength; ++i) {
  4113. var innerTxt = parseNode(children[i]);
  4114. if (innerTxt === '') {
  4115. continue;
  4116. }
  4117. txt += innerTxt;
  4118. }
  4119. }
  4120. // cleanup
  4121. txt = txt.trim();
  4122. txt = '> ' + txt.split('\n').join('\n> ');
  4123. return txt;
  4124. }
  4125. function parseCodeSpan (node) {
  4126. return '`' + node.innerHTML + '`';
  4127. }
  4128. function parseStrong (node) {
  4129. var txt = '';
  4130. if (node.hasChildNodes()) {
  4131. txt += '**';
  4132. var children = node.childNodes,
  4133. childrenLength = children.length;
  4134. for (var i = 0; i < childrenLength; ++i) {
  4135. txt += parseNode(children[i]);
  4136. }
  4137. txt += '**';
  4138. }
  4139. return txt;
  4140. }
  4141. function parseEmphasis (node) {
  4142. var txt = '';
  4143. if (node.hasChildNodes()) {
  4144. txt += '*';
  4145. var children = node.childNodes,
  4146. childrenLength = children.length;
  4147. for (var i = 0; i < childrenLength; ++i) {
  4148. txt += parseNode(children[i]);
  4149. }
  4150. txt += '*';
  4151. }
  4152. return txt;
  4153. }
  4154. function parseDel (node) {
  4155. var txt = '';
  4156. if (node.hasChildNodes()) {
  4157. txt += '~~';
  4158. var children = node.childNodes,
  4159. childrenLength = children.length;
  4160. for (var i = 0; i < childrenLength; ++i) {
  4161. txt += parseNode(children[i]);
  4162. }
  4163. txt += '~~';
  4164. }
  4165. return txt;
  4166. }
  4167. function parseLinks (node) {
  4168. var txt = '';
  4169. if (node.hasChildNodes() && node.hasAttribute('href')) {
  4170. var children = node.childNodes,
  4171. childrenLength = children.length;
  4172. txt = '[';
  4173. for (var i = 0; i < childrenLength; ++i) {
  4174. txt += parseNode(children[i]);
  4175. }
  4176. txt += '](';
  4177. txt += '<' + node.getAttribute('href') + '>';
  4178. if (node.hasAttribute('title')) {
  4179. txt += ' "' + node.getAttribute('title') + '"';
  4180. }
  4181. txt += ')';
  4182. }
  4183. return txt;
  4184. }
  4185. function parseImage (node) {
  4186. var txt = '';
  4187. if (node.hasAttribute('src')) {
  4188. txt += '![' + node.getAttribute('alt') + '](';
  4189. txt += '<' + node.getAttribute('src') + '>';
  4190. if (node.hasAttribute('width') && node.hasAttribute('height')) {
  4191. txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
  4192. }
  4193. if (node.hasAttribute('title')) {
  4194. txt += ' "' + node.getAttribute('title') + '"';
  4195. }
  4196. txt += ')';
  4197. }
  4198. return txt;
  4199. }
  4200. function parseHeader (node, headerLevel) {
  4201. var headerMark = new Array(headerLevel + 1).join('#'),
  4202. txt = '';
  4203. if (node.hasChildNodes()) {
  4204. txt = headerMark + ' ';
  4205. var children = node.childNodes,
  4206. childrenLength = children.length;
  4207. for (var i = 0; i < childrenLength; ++i) {
  4208. txt += parseNode(children[i]);
  4209. }
  4210. }
  4211. return txt;
  4212. }
  4213. function parseParagraph (node) {
  4214. var txt = '';
  4215. if (node.hasChildNodes()) {
  4216. var children = node.childNodes,
  4217. childrenLength = children.length;
  4218. for (var i = 0; i < childrenLength; ++i) {
  4219. txt += parseNode(children[i]);
  4220. }
  4221. }
  4222. // some text normalization
  4223. txt = txt.trim();
  4224. return txt;
  4225. }
  4226. function parsePreCode (node) {
  4227. var lang = node.getAttribute('language'),
  4228. num = node.getAttribute('precodenum');
  4229. return '```' + lang + '\n' + preList[num] + '\n```';
  4230. }
  4231. function parsePre (node) {
  4232. var num = node.getAttribute('prenum');
  4233. return '<pre>' + preList[num] + '</pre>';
  4234. }
  4235. function parseTable (node) {
  4236. var txt = '',
  4237. tableArray = [[], []],
  4238. headings = node.querySelectorAll('thead>tr>th'),
  4239. rows = node.querySelectorAll('tbody>tr'),
  4240. i, ii;
  4241. for (i = 0; i < headings.length; ++i) {
  4242. var headContent = parseTableCell(headings[i]),
  4243. allign = '---';
  4244. if (headings[i].hasAttribute('style')) {
  4245. var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, '');
  4246. switch (style) {
  4247. case 'text-align:left;':
  4248. allign = ':---';
  4249. break;
  4250. case 'text-align:right;':
  4251. allign = '---:';
  4252. break;
  4253. case 'text-align:center;':
  4254. allign = ':---:';
  4255. break;
  4256. }
  4257. }
  4258. tableArray[0][i] = headContent.trim();
  4259. tableArray[1][i] = allign;
  4260. }
  4261. for (i = 0; i < rows.length; ++i) {
  4262. var r = tableArray.push([]) - 1,
  4263. cols = rows[i].getElementsByTagName('td');
  4264. for (ii = 0; ii < headings.length; ++ii) {
  4265. var cellContent = ' ';
  4266. if (typeof cols[ii] !== 'undefined') {
  4267. cellContent = parseTableCell(cols[ii]);
  4268. }
  4269. tableArray[r].push(cellContent);
  4270. }
  4271. }
  4272. var cellSpacesCount = 3;
  4273. for (i = 0; i < tableArray.length; ++i) {
  4274. for (ii = 0; ii < tableArray[i].length; ++ii) {
  4275. var strLen = tableArray[i][ii].length;
  4276. if (strLen > cellSpacesCount) {
  4277. cellSpacesCount = strLen;
  4278. }
  4279. }
  4280. }
  4281. for (i = 0; i < tableArray.length; ++i) {
  4282. for (ii = 0; ii < tableArray[i].length; ++ii) {
  4283. if (i === 1) {
  4284. if (tableArray[i][ii].slice(-1) === ':') {
  4285. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
  4286. } else {
  4287. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
  4288. }
  4289. } else {
  4290. tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount);
  4291. }
  4292. }
  4293. txt += '| ' + tableArray[i].join(' | ') + ' |\n';
  4294. }
  4295. return txt.trim();
  4296. }
  4297. function parseTableCell (node) {
  4298. var txt = '';
  4299. if (!node.hasChildNodes()) {
  4300. return '';
  4301. }
  4302. var children = node.childNodes,
  4303. childrenLength = children.length;
  4304. for (var i = 0; i < childrenLength; ++i) {
  4305. txt += parseNode(children[i], true);
  4306. }
  4307. return txt.trim();
  4308. }
  4309. function clean (node) {
  4310. for (var n = 0; n < node.childNodes.length; ++n) {
  4311. var child = node.childNodes[n];
  4312. if (child.nodeType === 3) {
  4313. if (!/\S/.test(child.nodeValue)) {
  4314. node.removeChild(child);
  4315. --n;
  4316. } else {
  4317. child.nodeValue = child.nodeValue.split('\n').join(' ');
  4318. child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
  4319. }
  4320. } else if (child.nodeType === 1) {
  4321. clean(child);
  4322. }
  4323. }
  4324. }
  4325. // find all pre tags and replace contents with placeholder
  4326. // we need this so that we can remove all indentation from html
  4327. // to ease up parsing
  4328. function substitutePreCodeTags (doc) {
  4329. var pres = doc.querySelectorAll('pre'),
  4330. presPH = [];
  4331. for (var i = 0; i < pres.length; ++i) {
  4332. if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
  4333. var content = pres[i].firstChild.innerHTML.trim(),
  4334. language = pres[i].firstChild.getAttribute('data-language') || '';
  4335. // if data-language attribute is not defined, then we look for class language-*
  4336. if (language === '') {
  4337. var classes = pres[i].firstChild.className.split(' ');
  4338. for (var c = 0; c < classes.length; ++c) {
  4339. var matches = classes[c].match(/^language-(.+)$/);
  4340. if (matches !== null) {
  4341. language = matches[1];
  4342. break;
  4343. }
  4344. }
  4345. }
  4346. // unescape html entities in content
  4347. content = showdown.helper.unescapeHTMLEntities(content);
  4348. presPH.push(content);
  4349. pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
  4350. } else {
  4351. presPH.push(pres[i].innerHTML);
  4352. pres[i].innerHTML = '';
  4353. pres[i].setAttribute('prenum', i.toString());
  4354. }
  4355. }
  4356. return presPH;
  4357. }
  4358. return mdDoc;
  4359. };
  4360. /**
  4361. * Set an option of this Converter instance
  4362. * @param {string} key
  4363. * @param {*} value
  4364. */
  4365. this.setOption = function (key, value) {
  4366. options[key] = value;
  4367. };
  4368. /**
  4369. * Get the option of this Converter instance
  4370. * @param {string} key
  4371. * @returns {*}
  4372. */
  4373. this.getOption = function (key) {
  4374. return options[key];
  4375. };
  4376. /**
  4377. * Get the options of this Converter instance
  4378. * @returns {{}}
  4379. */
  4380. this.getOptions = function () {
  4381. return options;
  4382. };
  4383. /**
  4384. * Add extension to THIS converter
  4385. * @param {{}} extension
  4386. * @param {string} [name=null]
  4387. */
  4388. this.addExtension = function (extension, name) {
  4389. name = name || null;
  4390. _parseExtension(extension, name);
  4391. };
  4392. /**
  4393. * Use a global registered extension with THIS converter
  4394. * @param {string} extensionName Name of the previously registered extension
  4395. */
  4396. this.useExtension = function (extensionName) {
  4397. _parseExtension(extensionName);
  4398. };
  4399. /**
  4400. * Set the flavor THIS converter should use
  4401. * @param {string} name
  4402. */
  4403. this.setFlavor = function (name) {
  4404. if (!flavor.hasOwnProperty(name)) {
  4405. throw Error(name + ' flavor was not found');
  4406. }
  4407. var preset = flavor[name];
  4408. setConvFlavor = name;
  4409. for (var option in preset) {
  4410. if (preset.hasOwnProperty(option)) {
  4411. options[option] = preset[option];
  4412. }
  4413. }
  4414. };
  4415. /**
  4416. * Get the currently set flavor of this converter
  4417. * @returns {string}
  4418. */
  4419. this.getFlavor = function () {
  4420. return setConvFlavor;
  4421. };
  4422. /**
  4423. * Remove an extension from THIS converter.
  4424. * Note: This is a costly operation. It's better to initialize a new converter
  4425. * and specify the extensions you wish to use
  4426. * @param {Array} extension
  4427. */
  4428. this.removeExtension = function (extension) {
  4429. if (!showdown.helper.isArray(extension)) {
  4430. extension = [extension];
  4431. }
  4432. for (var a = 0; a < extension.length; ++a) {
  4433. var ext = extension[a];
  4434. for (var i = 0; i < langExtensions.length; ++i) {
  4435. if (langExtensions[i] === ext) {
  4436. langExtensions[i].splice(i, 1);
  4437. }
  4438. }
  4439. for (var ii = 0; ii < outputModifiers.length; ++i) {
  4440. if (outputModifiers[ii] === ext) {
  4441. outputModifiers[ii].splice(i, 1);
  4442. }
  4443. }
  4444. }
  4445. };
  4446. /**
  4447. * Get all extension of THIS converter
  4448. * @returns {{language: Array, output: Array}}
  4449. */
  4450. this.getAllExtensions = function () {
  4451. return {
  4452. language: langExtensions,
  4453. output: outputModifiers
  4454. };
  4455. };
  4456. /**
  4457. * Get the metadata of the previously parsed document
  4458. * @param raw
  4459. * @returns {string|{}}
  4460. */
  4461. this.getMetadata = function (raw) {
  4462. if (raw) {
  4463. return metadata.raw;
  4464. } else {
  4465. return metadata.parsed;
  4466. }
  4467. };
  4468. /**
  4469. * Get the metadata format of the previously parsed document
  4470. * @returns {string}
  4471. */
  4472. this.getMetadataFormat = function () {
  4473. return metadata.format;
  4474. };
  4475. /**
  4476. * Private: set a single key, value metadata pair
  4477. * @param {string} key
  4478. * @param {string} value
  4479. */
  4480. this._setMetadataPair = function (key, value) {
  4481. metadata.parsed[key] = value;
  4482. };
  4483. /**
  4484. * Private: set metadata format
  4485. * @param {string} format
  4486. */
  4487. this._setMetadataFormat = function (format) {
  4488. metadata.format = format;
  4489. };
  4490. /**
  4491. * Private: set metadata raw text
  4492. * @param {string} raw
  4493. */
  4494. this._setMetadataRaw = function (raw) {
  4495. metadata.raw = raw;
  4496. };
  4497. };
  4498. var root = this;
  4499. // AMD Loader
  4500. if (typeof define === 'function' && define.amd) {
  4501. define(function () {
  4502. 'use strict';
  4503. return showdown;
  4504. });
  4505. // CommonJS/nodeJS Loader
  4506. } else if (typeof module !== 'undefined' && module.exports) {
  4507. module.exports = showdown;
  4508. // Regular Browser loader
  4509. } else {
  4510. root.showdown = showdown;
  4511. }
  4512. }).call(this);
  4513. //# sourceMappingURL=showdown.js.map