{ "version": 3, "sources": ["../javascripts/helpers/markdown.ts"], "sourcesContent": ["import i18next from 'i18next';\nimport sanitizeHtml from 'sanitize-html';\nimport ShowdownService from 'showdown';\n\nconst showdownService = new ShowdownService.Converter({\n openLinksInNewWindow: true,\n simpleLineBreaks: true,\n});\n\n// Helper function to convert raw URLs to clickable links\nconst linkifyRawUrls = (text: string) => {\n const urlRegex = /(^|[^\\\\[(])\\b(https?:\\/\\/[\\w\\-\\.]+(:\\d+)?(\\/[^\\s]*)?)(?![\\])])/g;\n return text.replace(urlRegex, (_match, prefix, url) => {\n // Skip URLs already part of a CommonMark link\n return `${prefix}[${i18next.t('link', { ns: 'common' })}](${url})`;\n });\n};\n\nexport const asHtml = (raw?: string) => {\n if (!raw) return '';\n // Convert raw links to markdown links before passing to showdown\n const linkified = linkifyRawUrls(raw);\n return showdownService.makeHtml(sanitizeHtml(linkified || ''));\n};\n"], "mappings": "oJACA,IAAAA,EAAyB,SACzBC,EAA4B,SAEtBC,EAAkB,IAAI,EAAAC,QAAgB,UAAU,CACpD,qBAAsB,GACtB,iBAAkB,EACpB,CAAC,EAGKC,EAAkBC,GAAiB,CACvC,IAAMC,EAAW,kEACjB,OAAOD,EAAK,QAAQC,EAAU,CAACC,EAAQC,EAAQC,IAEtC,GAAGD,CAAM,IAAIE,EAAQ,EAAE,OAAQ,CAAE,GAAI,QAAS,CAAC,CAAC,KAAKD,CAAG,GAChE,CACH,EAEaE,EAAUC,GAAiB,CACtC,GAAI,CAACA,EAAK,MAAO,GAEjB,IAAMC,EAAYT,EAAeQ,CAAG,EACpC,OAAOV,EAAgB,YAAS,EAAAY,SAAaD,GAAa,EAAE,CAAC,CAC/D", "names": ["import_sanitize_html", "import_showdown", "showdownService", "ShowdownService", "linkifyRawUrls", "text", "urlRegex", "_match", "prefix", "url", "instance", "asHtml", "raw", "linkified", "sanitizeHtml"] }