@covalent/markdown 10.5.1 → 10.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,11 +128,59 @@ function renderVideoElements(html) {
128
128
  .replace(ytShort, convert)
129
129
  .replace(ytPlaylist, convertPL);
130
130
  }
131
+ /**
132
+ * Checks whether text contains markdown syntax patterns.
133
+ */
134
+ function containsMarkdown(text) {
135
+ const markdownPatterns = [
136
+ /(?:^|\n)\s{0,3}#{1,6}\s/, // ATX headings
137
+ /(?:^|\n)\s{0,3}[-*+]\s/, // unordered list items
138
+ /(?:^|\n)\s{0,3}\d+\.\s/, // ordered list items
139
+ /(?:^|\n)\s{0,3}>\s/, // blockquotes
140
+ /\*\*.+?\*\*/s, // bold
141
+ /\[.+?\]\(.+?\)/s, // links
142
+ /!\[.*?\]\(.+?\)/s, // images
143
+ /`.+?`/, // inline code
144
+ /(?:^|\n)\s{0,3}```/, // fenced code blocks
145
+ /(?:^|\n)\s{0,3}---\s*(?:$|\n)/, // horizontal rules
146
+ ];
147
+ return markdownPatterns.some((pattern) => pattern.test(text));
148
+ }
149
+ /**
150
+ * Finds the index of the matching closing tag, handling nested same-name tags.
151
+ */
152
+ function findClosingTagIndex(str, tagName, searchFrom) {
153
+ const openPattern = new RegExp(`<${tagName}(?:\\s[^>]*)?>`, 'gi');
154
+ const closePattern = new RegExp(`</${tagName}\\s*>`, 'gi');
155
+ let depth = 1;
156
+ let pos = searchFrom;
157
+ while (pos < str.length && depth > 0) {
158
+ openPattern.lastIndex = pos;
159
+ closePattern.lastIndex = pos;
160
+ // we look for open and close tags starting from the end of the last match
161
+ const nextOpen = openPattern.exec(str);
162
+ const nextClose = closePattern.exec(str);
163
+ if (!nextClose)
164
+ return -1;
165
+ // if we find an open tag before a close tag, it means we have a nested tag, so we increase the depth
166
+ if (nextOpen && nextOpen.index < nextClose.index) {
167
+ depth++;
168
+ pos = nextOpen.index + nextOpen[0].length;
169
+ }
170
+ else {
171
+ depth--;
172
+ if (depth === 0)
173
+ return nextClose.index;
174
+ pos = nextClose.index + nextClose[0].length;
175
+ }
176
+ }
177
+ return -1;
178
+ }
131
179
 
132
180
  const _c0 = ["*"];
133
181
  function isAbsoluteUrl(currentHref) {
134
182
  // Regular Expression to check url
135
- const RgExp = new RegExp('^(?:[a-z]+:)?//', 'i');
183
+ const RgExp = /^(?:[a-z]+:)?\/\//i;
136
184
  return RgExp.test(currentHref);
137
185
  }
138
186
  // TODO: assumes it is a github url
@@ -169,11 +217,11 @@ function generateHref(currentHref, relativeHref) {
169
217
  return '';
170
218
  }
171
219
  function normalizeHtmlHrefs(html, currentHref, fileLinkExtensions) {
172
- if (currentHref) {
173
- const document = new DOMParser().parseFromString(html, 'text/html');
174
- document
175
- .querySelectorAll('a[href]')
176
- .forEach((link) => {
220
+ const document = new DOMParser().parseFromString(html, 'text/html');
221
+ document
222
+ .querySelectorAll('a[href]')
223
+ .forEach((link) => {
224
+ try {
177
225
  const url = new URL(link.href);
178
226
  const originalHash = url.hash;
179
227
  const isFileAnchorLink = isFileLink(link, fileLinkExtensions);
@@ -186,7 +234,8 @@ function normalizeHtmlHrefs(html, currentHref, fileLinkExtensions) {
186
234
  else if (url.host === window.location.host) {
187
235
  // hosts match, meaning URL MIGHT have been malformed by showdown
188
236
  // url is a relative url or just a link to a part of the application
189
- if (url.pathname.endsWith('.md') || isFileAnchorLink) {
237
+ if (currentHref &&
238
+ (url.pathname.endsWith('.md') || isFileAnchorLink)) {
190
239
  // only check .md urls or urls ending with the fileLinkExtensions
191
240
  const hrefWithoutHash = removeTrailingHash(link.getAttribute('href'));
192
241
  url.href = generateHref(currentHref, hrefWithoutHash);
@@ -198,7 +247,7 @@ function normalizeHtmlHrefs(html, currentHref, fileLinkExtensions) {
198
247
  link.target = isFileAnchorLink ? '_self' : '_blank';
199
248
  }
200
249
  else {
201
- // url is absolute
250
+ // Different host - external link
202
251
  if (url.pathname.endsWith('.md')) {
203
252
  if (originalHash) {
204
253
  url.hash = genHeadingId(originalHash);
@@ -207,10 +256,16 @@ function normalizeHtmlHrefs(html, currentHref, fileLinkExtensions) {
207
256
  }
208
257
  link.target = '_blank';
209
258
  }
210
- });
211
- return new XMLSerializer().serializeToString(document);
212
- }
213
- return html;
259
+ }
260
+ catch {
261
+ // If URL parsing fails, check if it looks like an external http(s) link
262
+ const hrefAttr = (link.getAttribute('href') ?? '').trim();
263
+ if (hrefAttr.startsWith('http://') || hrefAttr.startsWith('https://')) {
264
+ link.target = '_blank';
265
+ }
266
+ }
267
+ });
268
+ return new XMLSerializer().serializeToString(document);
214
269
  }
215
270
  function normalizeImageSrcs(html, currentHref) {
216
271
  if (currentHref) {
@@ -272,6 +327,57 @@ function changeStyleAlignmentToClass(html) {
272
327
  }
273
328
  return html;
274
329
  }
330
+ /**
331
+ * Adds markdown="1" attribute to HTML block-level tags so that
332
+ * showdown parses any markdown nested inside them.
333
+ * Only adds the attribute when the tag's inner content contains markdown syntax.
334
+ */
335
+ function addMarkdownAttrToHtmlTags(markdown) {
336
+ const voidElements = new Set([
337
+ 'area',
338
+ 'base',
339
+ 'br',
340
+ 'col',
341
+ 'embed',
342
+ 'hr',
343
+ 'img',
344
+ 'input',
345
+ 'link',
346
+ 'meta',
347
+ 'param',
348
+ 'source',
349
+ 'track',
350
+ 'wbr',
351
+ ]);
352
+ const openTagRegex = /<([A-Za-z][A-Za-z0-9-]*)(\s[^>]*)?\s*>/g;
353
+ let result = '';
354
+ let lastIndex = 0;
355
+ let match;
356
+ while ((match = openTagRegex.exec(markdown)) !== null) {
357
+ const fullMatch = match[0];
358
+ const tagName = match[1];
359
+ const attrs = match[2] || '';
360
+ const tag = tagName.toLowerCase();
361
+ // Skip void elements, self-closing tags, or tags with existing markdown attr
362
+ if (voidElements.has(tag) ||
363
+ fullMatch.endsWith('/>') ||
364
+ /markdown\s*=/.test(attrs)) {
365
+ continue;
366
+ }
367
+ const contentStart = match.index + fullMatch.length;
368
+ const closingTagIndex = findClosingTagIndex(markdown, tagName, contentStart);
369
+ if (closingTagIndex === -1)
370
+ continue;
371
+ const innerContent = markdown.slice(contentStart, closingTagIndex);
372
+ if (containsMarkdown(innerContent)) {
373
+ result += markdown.slice(lastIndex, match.index);
374
+ result += fullMatch.replace(new RegExp(`<${tagName}(\\s|>)`), `<${tagName} markdown="1"$1`);
375
+ lastIndex = contentStart;
376
+ }
377
+ }
378
+ result += markdown.slice(lastIndex);
379
+ return result;
380
+ }
275
381
  // Strips all the html tags in the html sand returns the text
276
382
  function stripAllHtmlTags(input) {
277
383
  let sanitized = input;
@@ -472,7 +578,9 @@ class TdMarkdownComponent {
472
578
  converter.setOption('simpleLineBreaks', this._simpleLineBreaks);
473
579
  converter.setOption('disableForced4SpacesIndentedSublists', true);
474
580
  converter.setOption('emoji', true);
475
- return converter.makeHtml(markdownToParse);
581
+ const markdownWithAttr = addMarkdownAttrToHtmlTags(markdownToParse);
582
+ const html = converter.makeHtml(markdownWithAttr);
583
+ return html;
476
584
  }
477
585
  static ɵfac = function TdMarkdownComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdMarkdownComponent)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.DomSanitizer), i0.ɵɵdirectiveInject(i0.NgZone)); };
478
586
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TdMarkdownComponent, selectors: [["td-markdown"]], hostVars: 2, hostBindings: function TdMarkdownComponent_HostBindings(rf, ctx) { if (rf & 2) {
@@ -503,7 +611,7 @@ class TdMarkdownComponent {
503
611
  }], contentReady: [{
504
612
  type: Output
505
613
  }] }); })();
506
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdMarkdownComponent, { className: "TdMarkdownComponent", filePath: "lib/markdown.component.ts", lineNumber: 221 }); })();
614
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdMarkdownComponent, { className: "TdMarkdownComponent", filePath: "lib/markdown.component.ts", lineNumber: 297 }); })();
507
615
 
508
616
  class TdMarkdownLoaderService {
509
617
  _http;
@@ -570,5 +678,5 @@ class CovalentMarkdownModule {
570
678
  * Generated bundle index. Do not edit.
571
679
  */
572
680
 
573
- export { CovalentMarkdownModule, TdMarkdownComponent, TdMarkdownLoaderService, genHeadingId, isAnchorLink, isFileLink, isGithubHref, isRawGithubHref, rawGithubHref, removeLeadingHash, removeTrailingHash, renderVideoElements, scrollToAnchor };
681
+ export { CovalentMarkdownModule, TdMarkdownComponent, TdMarkdownLoaderService, containsMarkdown, findClosingTagIndex, genHeadingId, isAnchorLink, isFileLink, isGithubHref, isRawGithubHref, rawGithubHref, removeLeadingHash, removeTrailingHash, renderVideoElements, scrollToAnchor };
574
682
  //# sourceMappingURL=covalent-markdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"covalent-markdown.mjs","sources":["../../../../libs/markdown/src/lib/markdown-utils/markdown-utils.ts","../../../../libs/markdown/src/lib/markdown.component.ts","../../../../libs/markdown/src/lib/markdown.component.html","../../../../libs/markdown/src/lib/markdown-loader/markdown-loader.service.ts","../../../../libs/markdown/src/lib/markdown.module.ts","../../../../libs/markdown/src/covalent-markdown.ts"],"sourcesContent":["export function removeLeadingHash(str: string): string {\n if (str) {\n return str.replace(/^#+/, '');\n }\n return '';\n}\n\nexport function removeTrailingHash(str: string | null): string {\n if (str) {\n return str.replace(/#.*/, '');\n }\n return '';\n}\n\nexport function genHeadingId(str: string): string {\n if (str) {\n return removeLeadingHash(\n str\n .replace(/(_|-|\\s)+/g, '')\n // Remove certain special chars to create heading ids similar to those in github\n // borrowed from showdown\n // https://github.com/showdownjs/showdown/blob/main/src/subParsers/makehtml/headers.js#L94\n .replace(/[&+$,/:;=?@\"#{}|^¨~[\\]`\\\\*)(%.!'<>]/g, '')\n ).toLowerCase();\n }\n return '';\n}\n\nexport function scrollToAnchor(\n scope: HTMLElement,\n anchor: string,\n tryParent: boolean\n): boolean {\n if (scope && anchor) {\n const normalizedAnchor: string = genHeadingId(anchor);\n let headingToJumpTo: Element | null = null;\n const headingWithinComponent = scope.querySelector(\n `[id=\"${normalizedAnchor}\"]`\n );\n\n if (headingWithinComponent) {\n headingToJumpTo = headingWithinComponent;\n } else if (tryParent) {\n const parent = scope.parentElement;\n if (parent) {\n headingToJumpTo = parent.querySelector(`[id=\"${normalizedAnchor}\"]`);\n }\n }\n if (headingToJumpTo) {\n headingToJumpTo.scrollIntoView({ behavior: 'auto' });\n return true;\n }\n }\n return false;\n}\n\nexport function isAnchorLink(anchor?: HTMLAnchorElement): boolean {\n if (anchor) {\n const href = anchor.getAttribute('href');\n if (href) {\n return href.startsWith('#');\n }\n }\n return false;\n}\n\nexport function isFileLink(\n anchor: HTMLAnchorElement,\n fileExtensions: string[] | undefined\n): boolean {\n if (fileExtensions && fileExtensions.length) {\n const href = anchor.getAttribute('href');\n if (href) {\n return fileExtensions.some((fileExtension) =>\n href.endsWith(fileExtension)\n );\n }\n }\n return false;\n}\n\nconst RAW_GITHUB_HOSTNAME = 'raw.githubusercontent.com';\n\nexport function rawGithubHref(githubHref?: string): string {\n if (githubHref) {\n try {\n const url: URL = new URL(githubHref);\n if (url.hostname === RAW_GITHUB_HOSTNAME) {\n return url.href;\n } else if (isGithubHref(githubHref)) {\n url.hostname = RAW_GITHUB_HOSTNAME;\n url.pathname = url.pathname.split('/blob', 2).join('');\n return url.href;\n }\n } catch {\n return '';\n }\n }\n return '';\n}\n\nexport function isGithubHref(href?: string): boolean {\n try {\n const temp: URL = new URL(href ?? '');\n return temp.hostname === 'github.com';\n } catch {\n return false;\n }\n}\n\nexport function isRawGithubHref(href = ''): boolean {\n try {\n const temp: URL = new URL(href);\n return temp.hostname === RAW_GITHUB_HOSTNAME;\n } catch {\n return false;\n }\n}\n\nexport function renderVideoElements(html: string): string {\n const ytLongEmbed =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:embed\\/)([\\w-]{11})(\\?[\\w%;-]+(?:=[\\w%;-]+)?(?:&[\\w%;-]+(?:=[\\w%;-]+)?)*)?)]/gi;\n const ytLongWatch =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:watch\\?v=)([\\w-]{11})(&[\\w%;-]+(?:=[\\w%;-]+)?)*)]/gi;\n const ytShort =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)?youtu.be\\/([\\w-]{11})\\??([\\w%;-]+(?:=[\\w%;-]+)?(?:&[\\w%;-]+(?:=[\\w%;-]+)?)*)?]/gi;\n const ytPlaylist =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:playlist\\?list=)([\\w-]{34})(&[\\w%;-]+(?:=[\\w%;-]+)?)*)]/gi;\n\n function convert(match: string, id: string, flags: string): string {\n if (flags) {\n id += '?' + flags.replace(/&amp;/gi, '&');\n }\n return `<iframe allow=\"fullscreen\" frameborder=\"0\" src=\"https://www.youtube.com/embed/${id}\"></iframe>`;\n }\n function convertPL(match: string, id: string, flags: string): string {\n if (flags) {\n id += flags.replace(/&amp;/gi, '&');\n }\n return `<iframe allow=\"fullscreen\" frameborder=\"0\" src=\"https://www.youtube.com/embed/videoseries?list=${id}\"></iframe>`;\n }\n\n return html\n .replace(ytLongWatch, convert)\n .replace(ytLongEmbed, convert)\n .replace(ytShort, convert)\n .replace(ytPlaylist, convertPL);\n}\n","import {\n Component,\n AfterViewInit,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Renderer2,\n SecurityContext,\n OnChanges,\n SimpleChanges,\n HostBinding,\n NgZone,\n OnDestroy,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport {\n scrollToAnchor,\n genHeadingId,\n isAnchorLink,\n removeTrailingHash,\n rawGithubHref,\n isGithubHref,\n isRawGithubHref,\n renderVideoElements,\n isFileLink,\n} from './markdown-utils/markdown-utils';\n\nimport * as showdown from 'showdown';\n\nfunction isAbsoluteUrl(currentHref: string): boolean {\n // Regular Expression to check url\n const RgExp = new RegExp('^(?:[a-z]+:)?//', 'i');\n return RgExp.test(currentHref);\n}\n\n// TODO: assumes it is a github url\n// allow override somehow\nfunction generateHref(currentHref: string, relativeHref: string): string {\n if (currentHref && relativeHref) {\n if (isAbsoluteUrl(currentHref)) {\n const currentUrl: URL = new URL(currentHref);\n const path: string = currentUrl.pathname\n .split('/')\n .slice(1, -1)\n .join('/');\n const correctUrl: URL = new URL(currentHref);\n\n if (relativeHref.startsWith('/')) {\n // url is relative to top level\n const orgAndRepo: string = path.split('/').slice(0, 3).join('/');\n correctUrl.pathname = `${orgAndRepo}${relativeHref}`;\n } else {\n correctUrl.pathname = `${path}/${relativeHref}`;\n }\n return correctUrl.href;\n } else {\n const path: string = currentHref.split('/').slice(0, -1).join('/');\n\n if (relativeHref.startsWith('/')) {\n return `${path}${relativeHref}`;\n } else {\n return `${path}/${relativeHref}`;\n }\n }\n }\n return '';\n}\n\nfunction normalizeHtmlHrefs(\n html: string,\n currentHref: string,\n fileLinkExtensions?: string[],\n): string {\n if (currentHref) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n document\n .querySelectorAll<HTMLAnchorElement>('a[href]')\n .forEach((link: HTMLAnchorElement) => {\n const url: URL = new URL(link.href);\n const originalHash: string = url.hash;\n const isFileAnchorLink = isFileLink(link, fileLinkExtensions);\n if (isAnchorLink(link)) {\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n link.href = url.hash;\n }\n } else if (url.host === window.location.host) {\n // hosts match, meaning URL MIGHT have been malformed by showdown\n // url is a relative url or just a link to a part of the application\n if (url.pathname.endsWith('.md') || isFileAnchorLink) {\n // only check .md urls or urls ending with the fileLinkExtensions\n\n const hrefWithoutHash: string = removeTrailingHash(\n link.getAttribute('href'),\n );\n\n url.href = generateHref(currentHref, hrefWithoutHash);\n\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n }\n link.href = url.href;\n }\n link.target = isFileAnchorLink ? '_self' : '_blank';\n } else {\n // url is absolute\n if (url.pathname.endsWith('.md')) {\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n }\n link.href = url.href;\n }\n link.target = '_blank';\n }\n });\n\n return new XMLSerializer().serializeToString(document);\n }\n return html;\n}\n\nfunction normalizeImageSrcs(html: string, currentHref: string): string {\n if (currentHref) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n document\n .querySelectorAll<HTMLImageElement>('img[src]')\n .forEach((image: HTMLImageElement) => {\n const src = image.getAttribute('src') ?? '';\n try {\n /* tslint:disable-next-line:no-unused-expression */\n new URL(src);\n if (isGithubHref(src)) {\n image.src = rawGithubHref(src);\n }\n } catch {\n image.src = generateHref(\n isGithubHref(currentHref)\n ? rawGithubHref(currentHref)\n : currentHref,\n src,\n );\n }\n // gh svgs need to have ?sanitize=true\n if (isRawGithubHref(image.src)) {\n const url: URL = new URL(image.src);\n if (url.pathname.endsWith('.svg')) {\n url.searchParams.set('sanitize', 'true');\n image.src = url.href;\n }\n }\n });\n\n return new XMLSerializer().serializeToString(document);\n }\n return html;\n}\n\nfunction addIdsToHeadings(html: string): string {\n if (html) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n document\n .querySelectorAll('h1, h2, h3, h4, h5, h6')\n .forEach((heading: Element) => {\n const strippedInnerHTML = stripAllHtmlTags(heading.innerHTML);\n const id: string = genHeadingId(strippedInnerHTML);\n heading.setAttribute('id', id);\n });\n return new XMLSerializer().serializeToString(document);\n }\n return html;\n}\n\nfunction changeStyleAlignmentToClass(html: string) {\n if (html) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n ['right', 'center', 'left'].forEach((alignment: string) => {\n document\n .querySelectorAll(`[style*='text-align:${alignment}']`)\n .forEach((style: Element) => {\n style.setAttribute('class', `markdown-align-${alignment}`);\n });\n });\n\n return new XMLSerializer().serializeToString(document);\n }\n\n return html;\n}\n\n// Strips all the html tags in the html sand returns the text\nfunction stripAllHtmlTags(input: string): string {\n let sanitized = input;\n let previous;\n\n do {\n previous = sanitized;\n sanitized = sanitized.replace(/<[^>]+>/g, '');\n } while (previous !== sanitized);\n\n return sanitized;\n}\n\n@Component({\n selector: 'td-markdown',\n styleUrls: ['./markdown.component.scss'],\n templateUrl: './markdown.component.html',\n})\nexport class TdMarkdownComponent\n implements OnChanges, AfterViewInit, OnDestroy\n{\n private _content!: string;\n private _simpleLineBreaks = false;\n private _hostedUrl!: string;\n private _anchor!: string;\n private _viewInit = false;\n private _fileLinkExtensions!: string[] | undefined;\n private _anchorListener?: VoidFunction;\n /**\n * .td-markdown class added to host so ::ng-deep gets scoped.\n */\n @HostBinding('class') class = 'td-markdown';\n\n /**\n * content?: string\n *\n * Markdown format content to be parsed as html markup.\n *\n * e.g. README.md content.\n */\n @Input()\n set content(content: string) {\n this._content = content;\n }\n\n /**\n * simpleLineBreaks?: string\n *\n * Sets whether newline characters inside paragraphs and spans are parsed as <br/>.\n * Defaults to false.\n */\n @Input()\n set simpleLineBreaks(simpleLineBreaks: boolean) {\n this._simpleLineBreaks = simpleLineBreaks;\n }\n\n /**\n * hostedUrl?: string\n *\n * If markdown contains relative paths, this is required to generate correct urls.\n *\n */\n @Input()\n set hostedUrl(hostedUrl: string) {\n this._hostedUrl = hostedUrl;\n }\n\n /**\n * anchor?: string\n *\n * Anchor to jump to.\n *\n */\n @Input()\n set anchor(anchor: string) {\n this._anchor = anchor;\n }\n\n /**\n * The file extensions to monitor for in anchor tags. If an anchor's `href` ends\n * with these extensions, an event will be emitted instead of performing the default click action.\n * Example values: [\".ipynb\", \".zip\", \".docx\"]\n */\n @Input()\n set fileLinkExtensions(extensions: string[] | undefined) {\n this._fileLinkExtensions = extensions;\n }\n\n /**\n * Event emitted when an anchor tag with an `href` matching the specified\n * fileLinkExtensions is clicked. The emitted value is the URL of the clicked anchor.\n */\n @Output() fileLinkClicked = new EventEmitter<URL>();\n\n /**\n * contentReady?: function\n * Event emitted after the markdown content rendering is finished.\n */\n @Output() contentReady: EventEmitter<void> = new EventEmitter<void>();\n\n constructor(\n private _renderer: Renderer2,\n private _elementRef: ElementRef,\n private _domSanitizer: DomSanitizer,\n private _ngZone: NgZone,\n ) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n // only anchor changed\n if (\n changes['anchor'] &&\n !changes['content'] &&\n !changes['simpleLineBreaks'] &&\n !changes['hostedUrl']\n ) {\n scrollToAnchor(this._elementRef.nativeElement, this._anchor, true);\n } else {\n this.refresh();\n }\n }\n\n ngAfterViewInit(): void {\n if (!this._content) {\n this._loadContent(\n (<HTMLElement>this._elementRef.nativeElement).textContent,\n );\n }\n this._viewInit = true;\n\n // Caretaker note: the `scrollToAnchor` calls `element.scrollIntoView`, a native synchronous DOM\n // API and it doesn't require Angular running `ApplicationRef.tick()` each time the markdown component is clicked.\n // Host listener (added through `@HostListener`) cause Angular to add an event listener within the Angular zone.\n // It also calls `markViewDirty()` before calling the actual listener (the decorated class method).\n this._ngZone.runOutsideAngular(() => {\n this._anchorListener = this._renderer.listen(\n this._elementRef.nativeElement,\n 'click',\n (event: MouseEvent) => {\n const element: HTMLElement = <HTMLElement>event.srcElement;\n if (\n element.matches('a[href]') &&\n isAnchorLink(<HTMLAnchorElement>element)\n ) {\n this.handleAnchorClicks(event);\n } else if (\n element.matches('a[href]') &&\n isFileLink(<HTMLAnchorElement>element, this._fileLinkExtensions)\n ) {\n this.handleFileAnchorClicks(event);\n }\n },\n );\n });\n }\n\n ngOnDestroy(): void {\n this._anchorListener?.();\n }\n\n refresh(): void {\n if (this._content) {\n this._loadContent(this._content);\n } else if (this._viewInit) {\n this._loadContent(\n (<HTMLElement>this._elementRef.nativeElement).textContent,\n );\n }\n }\n\n /**\n * General method to parse a string markdown into HTML Elements and load them into the container\n */\n private _loadContent(markdown: string | null): void {\n if (markdown && markdown.trim().length > 0) {\n // Clean container\n this._renderer.setProperty(\n this._elementRef.nativeElement,\n 'innerHTML',\n '',\n );\n // Parse html string into actual HTML elements.\n this._elementFromString(this._render(markdown));\n }\n // TODO: timeout required since resizing of html elements occurs which causes a change in the scroll position\n this._ngZone.runOutsideAngular(() =>\n setTimeout(\n () =>\n scrollToAnchor(this._elementRef.nativeElement, this._anchor, true),\n 250,\n ),\n );\n this.contentReady.emit();\n }\n\n private handleAnchorClicks(event: Event): void {\n event.preventDefault();\n const url: URL = new URL((<HTMLAnchorElement>event.target).href);\n const hash: string = decodeURI(url.hash);\n scrollToAnchor(this._elementRef.nativeElement, hash, true);\n }\n\n private handleFileAnchorClicks(event: Event): void {\n event.preventDefault();\n const url: URL = new URL((<HTMLAnchorElement>event.target).href);\n this.fileLinkClicked.emit(url);\n }\n\n private _elementFromString(markupStr: string): HTMLDivElement {\n // Renderer2 doesnt have a parsing method, so we have to sanitize and use [innerHTML]\n // to parse the string into DOM element for now.\n const div: HTMLDivElement = this._renderer.createElement('div');\n this._renderer.appendChild(this._elementRef.nativeElement, div);\n\n const html: string =\n this._domSanitizer.sanitize(\n SecurityContext.STYLE,\n changeStyleAlignmentToClass(markupStr),\n ) ?? '';\n\n const htmlWithAbsoluteHrefs: string = normalizeHtmlHrefs(\n html,\n this._hostedUrl,\n this._fileLinkExtensions,\n );\n const htmlWithAbsoluteImgSrcs: string = normalizeImageSrcs(\n htmlWithAbsoluteHrefs,\n this._hostedUrl,\n );\n const htmlWithHeadingIds: string = addIdsToHeadings(\n htmlWithAbsoluteImgSrcs,\n );\n const htmlWithVideos: SafeHtml = renderVideoElements(htmlWithHeadingIds);\n this._renderer.setProperty(div, 'innerHTML', htmlWithVideos);\n return div;\n }\n\n private _render(markdown: string): string {\n // Trim leading and trailing newlines\n markdown = markdown\n .replace(/^(\\s|\\t)*\\n+/g, '')\n .replace(/(\\s|\\t)*\\n+(\\s|\\t)*$/g, '');\n // Split markdown by line characters\n let lines: string[] = markdown.split('\\n');\n\n // check how much indentation is used by the first actual markdown line\n const firstLineWhitespaceMatch = lines[0].match(/^(\\s|\\t)*/);\n const firstLineWhitespace: string = firstLineWhitespaceMatch\n ? firstLineWhitespaceMatch[0]\n : '';\n\n // Remove all indentation spaces so markdown can be parsed correctly\n const startingWhitespaceRegex = new RegExp('^' + firstLineWhitespace);\n lines = lines.map(function (line: string): string {\n return line.replace(startingWhitespaceRegex, '');\n });\n\n // Join lines again with line characters\n const markdownToParse: string = lines.join('\\n');\n\n // Convert markdown into html\n const converter: showdown.Converter = new showdown.Converter();\n converter.setOption('ghCodeBlocks', true);\n converter.setOption('ghCompatibleHeaderId', true);\n converter.setOption('tasklists', true);\n converter.setOption('tables', true);\n converter.setOption('literalMidWordUnderscores', true);\n converter.setOption('simpleLineBreaks', this._simpleLineBreaks);\n converter.setOption('disableForced4SpacesIndentedSublists', true);\n converter.setOption('emoji', true);\n return converter.makeHtml(markdownToParse);\n }\n}\n","<ng-content></ng-content>\n","import { Injectable, SecurityContext } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { HttpClient, HttpResponse } from '@angular/common/http';\nimport { isGithubHref, rawGithubHref } from '../markdown-utils/markdown-utils';\n\n@Injectable()\nexport class TdMarkdownLoaderService {\n constructor(private _http: HttpClient, private _sanitizer: DomSanitizer) {}\n\n async load(url: string, httpOptions: object = {}): Promise<string> {\n const sanitizedUrl: string =\n this._sanitizer.sanitize(SecurityContext.URL, url) ?? '';\n let urlToGet: string = sanitizedUrl;\n if (isGithubHref(sanitizedUrl)) {\n urlToGet = rawGithubHref(sanitizedUrl);\n }\n\n const response: HttpResponse<string> | undefined = await this._http\n .get(urlToGet, {\n ...httpOptions,\n responseType: 'text',\n observe: 'response',\n })\n .toPromise();\n const contentType: string = response?.headers.get('Content-Type') ?? '';\n if (\n contentType.includes('text/plain') ||\n contentType.includes('text/markdown')\n ) {\n return response?.body ?? '';\n } else {\n throw Error(`${contentType} is not a handled content type`);\n }\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport {\n provideHttpClient,\n withInterceptorsFromDi,\n} from '@angular/common/http';\n\nimport { TdMarkdownComponent } from './markdown.component';\nimport { TdMarkdownLoaderService } from './markdown-loader/markdown-loader.service';\n\n/**\n * @deprecated This module is deprecated and will be removed in future versions.\n * Please migrate to using standalone components as soon as possible.\n */\n@NgModule({\n exports: [TdMarkdownComponent],\n imports: [TdMarkdownComponent],\n providers: [\n TdMarkdownLoaderService,\n provideHttpClient(withInterceptorsFromDi()),\n ],\n})\nexport class CovalentMarkdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2"],"mappings":";;;;;;;AAAM,SAAU,iBAAiB,CAAC,GAAW,EAAA;IAC3C,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;AAEM,SAAU,kBAAkB,CAAC,GAAkB,EAAA;IACnD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;AAEM,SAAU,YAAY,CAAC,GAAW,EAAA;IACtC,IAAI,GAAG,EAAE;QACP,OAAO,iBAAiB,CACtB;AACG,aAAA,OAAO,CAAC,YAAY,EAAE,EAAE;;;;aAIxB,OAAO,CAAC,sCAAsC,EAAE,EAAE,CAAC,CACvD,CAAC,WAAW,EAAE;;AAEjB,IAAA,OAAO,EAAE;AACX;SAEgB,cAAc,CAC5B,KAAkB,EAClB,MAAc,EACd,SAAkB,EAAA;AAElB,IAAA,IAAI,KAAK,IAAI,MAAM,EAAE;AACnB,QAAA,MAAM,gBAAgB,GAAW,YAAY,CAAC,MAAM,CAAC;QACrD,IAAI,eAAe,GAAmB,IAAI;QAC1C,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAChD,CAAQ,KAAA,EAAA,gBAAgB,CAAI,EAAA,CAAA,CAC7B;QAED,IAAI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AA,CAAAC,EAAA,CAAA,YAAA,CAAA,CAAA,CAAA,EAAA;AAAvB,IAAA,OAAA,KAAA,iBAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,KAAA,EAAA,uBAAuB,WAAvB,uBAAuB,CAAA,IAAA,EAAA,CAAA;;iFAAvB,uBAAuB,EAAA,CAAA;cADnC;;;ACKD;;;AAGG;MASU,sBAAsB,CAAA;gHAAtB,sBAAsB,GAAA,CAAA,EAAA;4DAAtB,sBAAsB,EAAA,CAAA;AALtB,IAAA,OAAA,IAAA,iBAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,SAAA,EAAA;YACT,uBAAuB;YACvB,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAC5C,SAAA,EAAA,CAAA;;iFAEU,sBAAsB,EAAA,CAAA;cARlC,QAAQ;AAAC,QAAA,IAAA,EAAA,CAAA;gBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;gBAC9B,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC9B,gBAAA,SAAS,EAAE;oBACT,uBAAuB;oBACvB,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAC5C,iBAAA;AACF,aAAA;;wFACY,sBAAsB,EAAA,EAAA,OAAA,EAAA,CANvB,mBAAmB,CAAA,EAAA,OAAA,EAAA,CADnB,mBAAmB,CAAA,EAAA,CAAA,CAAA,EAAA,GAAA;;ACf/B;;AAEG;;;;"}
1
+ {"version":3,"file":"covalent-markdown.mjs","sources":["../../../../libs/markdown/src/lib/markdown-utils/markdown-utils.ts","../../../../libs/markdown/src/lib/markdown.component.ts","../../../../libs/markdown/src/lib/markdown.component.html","../../../../libs/markdown/src/lib/markdown-loader/markdown-loader.service.ts","../../../../libs/markdown/src/lib/markdown.module.ts","../../../../libs/markdown/src/covalent-markdown.ts"],"sourcesContent":["export function removeLeadingHash(str: string): string {\n if (str) {\n return str.replace(/^#+/, '');\n }\n return '';\n}\n\nexport function removeTrailingHash(str: string | null): string {\n if (str) {\n return str.replace(/#.*/, '');\n }\n return '';\n}\n\nexport function genHeadingId(str: string): string {\n if (str) {\n return removeLeadingHash(\n str\n .replace(/(_|-|\\s)+/g, '')\n // Remove certain special chars to create heading ids similar to those in github\n // borrowed from showdown\n // https://github.com/showdownjs/showdown/blob/main/src/subParsers/makehtml/headers.js#L94\n .replace(/[&+$,/:;=?@\"#{}|^¨~[\\]`\\\\*)(%.!'<>]/g, ''),\n ).toLowerCase();\n }\n return '';\n}\n\nexport function scrollToAnchor(\n scope: HTMLElement,\n anchor: string,\n tryParent: boolean,\n): boolean {\n if (scope && anchor) {\n const normalizedAnchor: string = genHeadingId(anchor);\n let headingToJumpTo: Element | null = null;\n const headingWithinComponent = scope.querySelector(\n `[id=\"${normalizedAnchor}\"]`,\n );\n\n if (headingWithinComponent) {\n headingToJumpTo = headingWithinComponent;\n } else if (tryParent) {\n const parent = scope.parentElement;\n if (parent) {\n headingToJumpTo = parent.querySelector(`[id=\"${normalizedAnchor}\"]`);\n }\n }\n if (headingToJumpTo) {\n headingToJumpTo.scrollIntoView({ behavior: 'auto' });\n return true;\n }\n }\n return false;\n}\n\nexport function isAnchorLink(anchor?: HTMLAnchorElement): boolean {\n if (anchor) {\n const href = anchor.getAttribute('href');\n if (href) {\n return href.startsWith('#');\n }\n }\n return false;\n}\n\nexport function isFileLink(\n anchor: HTMLAnchorElement,\n fileExtensions: string[] | undefined,\n): boolean {\n if (fileExtensions && fileExtensions.length) {\n const href = anchor.getAttribute('href');\n if (href) {\n return fileExtensions.some((fileExtension) =>\n href.endsWith(fileExtension),\n );\n }\n }\n return false;\n}\n\nconst RAW_GITHUB_HOSTNAME = 'raw.githubusercontent.com';\n\nexport function rawGithubHref(githubHref?: string): string {\n if (githubHref) {\n try {\n const url: URL = new URL(githubHref);\n if (url.hostname === RAW_GITHUB_HOSTNAME) {\n return url.href;\n } else if (isGithubHref(githubHref)) {\n url.hostname = RAW_GITHUB_HOSTNAME;\n url.pathname = url.pathname.split('/blob', 2).join('');\n return url.href;\n }\n } catch {\n return '';\n }\n }\n return '';\n}\n\nexport function isGithubHref(href?: string): boolean {\n try {\n const temp: URL = new URL(href ?? '');\n return temp.hostname === 'github.com';\n } catch {\n return false;\n }\n}\n\nexport function isRawGithubHref(href = ''): boolean {\n try {\n const temp: URL = new URL(href);\n return temp.hostname === RAW_GITHUB_HOSTNAME;\n } catch {\n return false;\n }\n}\n\nexport function renderVideoElements(html: string): string {\n const ytLongEmbed =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:embed\\/)([\\w-]{11})(\\?[\\w%;-]+(?:=[\\w%;-]+)?(?:&[\\w%;-]+(?:=[\\w%;-]+)?)*)?)]/gi;\n const ytLongWatch =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:watch\\?v=)([\\w-]{11})(&[\\w%;-]+(?:=[\\w%;-]+)?)*)]/gi;\n const ytShort =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)?youtu.be\\/([\\w-]{11})\\??([\\w%;-]+(?:=[\\w%;-]+)?(?:&[\\w%;-]+(?:=[\\w%;-]+)?)*)?]/gi;\n const ytPlaylist =\n /!\\[(?:(?:https?:)?(?:\\/\\/)?)(?:(?:www)?.)?youtube.(?:.+?)\\/(?:(?:playlist\\?list=)([\\w-]{34})(&[\\w%;-]+(?:=[\\w%;-]+)?)*)]/gi;\n\n function convert(match: string, id: string, flags: string): string {\n if (flags) {\n id += '?' + flags.replace(/&amp;/gi, '&');\n }\n return `<iframe allow=\"fullscreen\" frameborder=\"0\" src=\"https://www.youtube.com/embed/${id}\"></iframe>`;\n }\n function convertPL(match: string, id: string, flags: string): string {\n if (flags) {\n id += flags.replace(/&amp;/gi, '&');\n }\n return `<iframe allow=\"fullscreen\" frameborder=\"0\" src=\"https://www.youtube.com/embed/videoseries?list=${id}\"></iframe>`;\n }\n\n return html\n .replace(ytLongWatch, convert)\n .replace(ytLongEmbed, convert)\n .replace(ytShort, convert)\n .replace(ytPlaylist, convertPL);\n}\n\n/**\n * Checks whether text contains markdown syntax patterns.\n */\nexport function containsMarkdown(text: string): boolean {\n const markdownPatterns = [\n /(?:^|\\n)\\s{0,3}#{1,6}\\s/, // ATX headings\n /(?:^|\\n)\\s{0,3}[-*+]\\s/, // unordered list items\n /(?:^|\\n)\\s{0,3}\\d+\\.\\s/, // ordered list items\n /(?:^|\\n)\\s{0,3}>\\s/, // blockquotes\n /\\*\\*.+?\\*\\*/s, // bold\n /\\[.+?\\]\\(.+?\\)/s, // links\n /!\\[.*?\\]\\(.+?\\)/s, // images\n /`.+?`/, // inline code\n /(?:^|\\n)\\s{0,3}```/, // fenced code blocks\n /(?:^|\\n)\\s{0,3}---\\s*(?:$|\\n)/, // horizontal rules\n ];\n return markdownPatterns.some((pattern) => pattern.test(text));\n}\n\n/**\n * Finds the index of the matching closing tag, handling nested same-name tags.\n */\nexport function findClosingTagIndex(\n str: string,\n tagName: string,\n searchFrom: number,\n): number {\n const openPattern = new RegExp(`<${tagName}(?:\\\\s[^>]*)?>`, 'gi');\n const closePattern = new RegExp(`</${tagName}\\\\s*>`, 'gi');\n let depth = 1;\n let pos = searchFrom;\n\n while (pos < str.length && depth > 0) {\n openPattern.lastIndex = pos;\n closePattern.lastIndex = pos;\n\n // we look for open and close tags starting from the end of the last match\n const nextOpen = openPattern.exec(str);\n const nextClose = closePattern.exec(str);\n\n if (!nextClose) return -1;\n\n // if we find an open tag before a close tag, it means we have a nested tag, so we increase the depth\n if (nextOpen && nextOpen.index < nextClose.index) {\n depth++;\n pos = nextOpen.index + nextOpen[0].length;\n } else {\n depth--;\n if (depth === 0) return nextClose.index;\n pos = nextClose.index + nextClose[0].length;\n }\n }\n\n return -1;\n}\n","import {\n Component,\n AfterViewInit,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Renderer2,\n SecurityContext,\n OnChanges,\n SimpleChanges,\n HostBinding,\n NgZone,\n OnDestroy,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport {\n scrollToAnchor,\n genHeadingId,\n isAnchorLink,\n removeTrailingHash,\n rawGithubHref,\n isGithubHref,\n isRawGithubHref,\n renderVideoElements,\n isFileLink,\n findClosingTagIndex,\n containsMarkdown,\n} from './markdown-utils/markdown-utils';\n\nimport * as showdown from 'showdown';\n\nfunction isAbsoluteUrl(currentHref: string): boolean {\n // Regular Expression to check url\n const RgExp = /^(?:[a-z]+:)?\\/\\//i;\n return RgExp.test(currentHref);\n}\n\n// TODO: assumes it is a github url\n// allow override somehow\nfunction generateHref(currentHref: string, relativeHref: string): string {\n if (currentHref && relativeHref) {\n if (isAbsoluteUrl(currentHref)) {\n const currentUrl: URL = new URL(currentHref);\n const path: string = currentUrl.pathname\n .split('/')\n .slice(1, -1)\n .join('/');\n const correctUrl: URL = new URL(currentHref);\n\n if (relativeHref.startsWith('/')) {\n // url is relative to top level\n const orgAndRepo: string = path.split('/').slice(0, 3).join('/');\n correctUrl.pathname = `${orgAndRepo}${relativeHref}`;\n } else {\n correctUrl.pathname = `${path}/${relativeHref}`;\n }\n return correctUrl.href;\n } else {\n const path: string = currentHref.split('/').slice(0, -1).join('/');\n\n if (relativeHref.startsWith('/')) {\n return `${path}${relativeHref}`;\n } else {\n return `${path}/${relativeHref}`;\n }\n }\n }\n return '';\n}\n\nfunction normalizeHtmlHrefs(\n html: string,\n currentHref: string,\n fileLinkExtensions?: string[],\n): string {\n const document: Document = new DOMParser().parseFromString(html, 'text/html');\n document\n .querySelectorAll<HTMLAnchorElement>('a[href]')\n .forEach((link: HTMLAnchorElement) => {\n try {\n const url: URL = new URL(link.href);\n const originalHash: string = url.hash;\n const isFileAnchorLink = isFileLink(link, fileLinkExtensions);\n\n if (isAnchorLink(link)) {\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n link.href = url.hash;\n }\n } else if (url.host === window.location.host) {\n // hosts match, meaning URL MIGHT have been malformed by showdown\n // url is a relative url or just a link to a part of the application\n if (\n currentHref &&\n (url.pathname.endsWith('.md') || isFileAnchorLink)\n ) {\n // only check .md urls or urls ending with the fileLinkExtensions\n\n const hrefWithoutHash: string = removeTrailingHash(\n link.getAttribute('href'),\n );\n\n url.href = generateHref(currentHref, hrefWithoutHash);\n\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n }\n link.href = url.href;\n }\n link.target = isFileAnchorLink ? '_self' : '_blank';\n } else {\n // Different host - external link\n if (url.pathname.endsWith('.md')) {\n if (originalHash) {\n url.hash = genHeadingId(originalHash);\n }\n link.href = url.href;\n }\n link.target = '_blank';\n }\n } catch {\n // If URL parsing fails, check if it looks like an external http(s) link\n const hrefAttr = (link.getAttribute('href') ?? '').trim();\n if (hrefAttr.startsWith('http://') || hrefAttr.startsWith('https://')) {\n link.target = '_blank';\n }\n }\n });\n\n return new XMLSerializer().serializeToString(document);\n}\n\nfunction normalizeImageSrcs(html: string, currentHref: string): string {\n if (currentHref) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n document\n .querySelectorAll<HTMLImageElement>('img[src]')\n .forEach((image: HTMLImageElement) => {\n const src = image.getAttribute('src') ?? '';\n try {\n /* tslint:disable-next-line:no-unused-expression */\n new URL(src);\n if (isGithubHref(src)) {\n image.src = rawGithubHref(src);\n }\n } catch {\n image.src = generateHref(\n isGithubHref(currentHref)\n ? rawGithubHref(currentHref)\n : currentHref,\n src,\n );\n }\n // gh svgs need to have ?sanitize=true\n if (isRawGithubHref(image.src)) {\n const url: URL = new URL(image.src);\n if (url.pathname.endsWith('.svg')) {\n url.searchParams.set('sanitize', 'true');\n image.src = url.href;\n }\n }\n });\n\n return new XMLSerializer().serializeToString(document);\n }\n return html;\n}\n\nfunction addIdsToHeadings(html: string): string {\n if (html) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n document\n .querySelectorAll('h1, h2, h3, h4, h5, h6')\n .forEach((heading: Element) => {\n const strippedInnerHTML = stripAllHtmlTags(heading.innerHTML);\n const id: string = genHeadingId(strippedInnerHTML);\n heading.setAttribute('id', id);\n });\n return new XMLSerializer().serializeToString(document);\n }\n return html;\n}\n\nfunction changeStyleAlignmentToClass(html: string) {\n if (html) {\n const document: Document = new DOMParser().parseFromString(\n html,\n 'text/html',\n );\n ['right', 'center', 'left'].forEach((alignment: string) => {\n document\n .querySelectorAll(`[style*='text-align:${alignment}']`)\n .forEach((style: Element) => {\n style.setAttribute('class', `markdown-align-${alignment}`);\n });\n });\n\n return new XMLSerializer().serializeToString(document);\n }\n\n return html;\n}\n\n/**\n * Adds markdown=\"1\" attribute to HTML block-level tags so that\n * showdown parses any markdown nested inside them.\n * Only adds the attribute when the tag's inner content contains markdown syntax.\n */\nfunction addMarkdownAttrToHtmlTags(markdown: string): string {\n const voidElements = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ]);\n\n const openTagRegex = /<([A-Za-z][A-Za-z0-9-]*)(\\s[^>]*)?\\s*>/g;\n let result = '';\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = openTagRegex.exec(markdown)) !== null) {\n const fullMatch = match[0];\n const tagName = match[1];\n const attrs = match[2] || '';\n const tag = tagName.toLowerCase();\n\n // Skip void elements, self-closing tags, or tags with existing markdown attr\n if (\n voidElements.has(tag) ||\n fullMatch.endsWith('/>') ||\n /markdown\\s*=/.test(attrs)\n ) {\n continue;\n }\n\n const contentStart = match.index + fullMatch.length;\n const closingTagIndex = findClosingTagIndex(\n markdown,\n tagName,\n contentStart,\n );\n\n if (closingTagIndex === -1) continue;\n\n const innerContent = markdown.slice(contentStart, closingTagIndex);\n\n if (containsMarkdown(innerContent)) {\n result += markdown.slice(lastIndex, match.index);\n result += fullMatch.replace(\n new RegExp(`<${tagName}(\\\\s|>)`),\n `<${tagName} markdown=\"1\"$1`,\n );\n lastIndex = contentStart;\n }\n }\n\n result += markdown.slice(lastIndex);\n return result;\n}\n\n// Strips all the html tags in the html sand returns the text\nfunction stripAllHtmlTags(input: string): string {\n let sanitized = input;\n let previous;\n\n do {\n previous = sanitized;\n sanitized = sanitized.replace(/<[^>]+>/g, '');\n } while (previous !== sanitized);\n\n return sanitized;\n}\n\n@Component({\n selector: 'td-markdown',\n styleUrls: ['./markdown.component.scss'],\n templateUrl: './markdown.component.html',\n})\nexport class TdMarkdownComponent\n implements OnChanges, AfterViewInit, OnDestroy\n{\n private _content!: string;\n private _simpleLineBreaks = false;\n private _hostedUrl!: string;\n private _anchor!: string;\n private _viewInit = false;\n private _fileLinkExtensions!: string[] | undefined;\n private _anchorListener?: VoidFunction;\n /**\n * .td-markdown class added to host so ::ng-deep gets scoped.\n */\n @HostBinding('class') class = 'td-markdown';\n\n /**\n * content?: string\n *\n * Markdown format content to be parsed as html markup.\n *\n * e.g. README.md content.\n */\n @Input()\n set content(content: string) {\n this._content = content;\n }\n\n /**\n * simpleLineBreaks?: string\n *\n * Sets whether newline characters inside paragraphs and spans are parsed as <br/>.\n * Defaults to false.\n */\n @Input()\n set simpleLineBreaks(simpleLineBreaks: boolean) {\n this._simpleLineBreaks = simpleLineBreaks;\n }\n\n /**\n * hostedUrl?: string\n *\n * If markdown contains relative paths, this is required to generate correct urls.\n *\n */\n @Input()\n set hostedUrl(hostedUrl: string) {\n this._hostedUrl = hostedUrl;\n }\n\n /**\n * anchor?: string\n *\n * Anchor to jump to.\n *\n */\n @Input()\n set anchor(anchor: string) {\n this._anchor = anchor;\n }\n\n /**\n * The file extensions to monitor for in anchor tags. If an anchor's `href` ends\n * with these extensions, an event will be emitted instead of performing the default click action.\n * Example values: [\".ipynb\", \".zip\", \".docx\"]\n */\n @Input()\n set fileLinkExtensions(extensions: string[] | undefined) {\n this._fileLinkExtensions = extensions;\n }\n\n /**\n * Event emitted when an anchor tag with an `href` matching the specified\n * fileLinkExtensions is clicked. The emitted value is the URL of the clicked anchor.\n */\n @Output() fileLinkClicked = new EventEmitter<URL>();\n\n /**\n * contentReady?: function\n * Event emitted after the markdown content rendering is finished.\n */\n @Output() contentReady: EventEmitter<void> = new EventEmitter<void>();\n\n constructor(\n private _renderer: Renderer2,\n private _elementRef: ElementRef,\n private _domSanitizer: DomSanitizer,\n private _ngZone: NgZone,\n ) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n // only anchor changed\n if (\n changes['anchor'] &&\n !changes['content'] &&\n !changes['simpleLineBreaks'] &&\n !changes['hostedUrl']\n ) {\n scrollToAnchor(this._elementRef.nativeElement, this._anchor, true);\n } else {\n this.refresh();\n }\n }\n\n ngAfterViewInit(): void {\n if (!this._content) {\n this._loadContent(\n (<HTMLElement>this._elementRef.nativeElement).textContent,\n );\n }\n this._viewInit = true;\n\n // Caretaker note: the `scrollToAnchor` calls `element.scrollIntoView`, a native synchronous DOM\n // API and it doesn't require Angular running `ApplicationRef.tick()` each time the markdown component is clicked.\n // Host listener (added through `@HostListener`) cause Angular to add an event listener within the Angular zone.\n // It also calls `markViewDirty()` before calling the actual listener (the decorated class method).\n this._ngZone.runOutsideAngular(() => {\n this._anchorListener = this._renderer.listen(\n this._elementRef.nativeElement,\n 'click',\n (event: MouseEvent) => {\n const element: HTMLElement = <HTMLElement>event.srcElement;\n if (\n element.matches('a[href]') &&\n isAnchorLink(<HTMLAnchorElement>element)\n ) {\n this.handleAnchorClicks(event);\n } else if (\n element.matches('a[href]') &&\n isFileLink(<HTMLAnchorElement>element, this._fileLinkExtensions)\n ) {\n this.handleFileAnchorClicks(event);\n }\n },\n );\n });\n }\n\n ngOnDestroy(): void {\n this._anchorListener?.();\n }\n\n refresh(): void {\n if (this._content) {\n this._loadContent(this._content);\n } else if (this._viewInit) {\n this._loadContent(\n (<HTMLElement>this._elementRef.nativeElement).textContent,\n );\n }\n }\n\n /**\n * General method to parse a string markdown into HTML Elements and load them into the container\n */\n private _loadContent(markdown: string | null): void {\n if (markdown && markdown.trim().length > 0) {\n // Clean container\n this._renderer.setProperty(\n this._elementRef.nativeElement,\n 'innerHTML',\n '',\n );\n // Parse html string into actual HTML elements.\n this._elementFromString(this._render(markdown));\n }\n // TODO: timeout required since resizing of html elements occurs which causes a change in the scroll position\n this._ngZone.runOutsideAngular(() =>\n setTimeout(\n () =>\n scrollToAnchor(this._elementRef.nativeElement, this._anchor, true),\n 250,\n ),\n );\n this.contentReady.emit();\n }\n\n private handleAnchorClicks(event: Event): void {\n event.preventDefault();\n const url: URL = new URL((<HTMLAnchorElement>event.target).href);\n const hash: string = decodeURI(url.hash);\n scrollToAnchor(this._elementRef.nativeElement, hash, true);\n }\n\n private handleFileAnchorClicks(event: Event): void {\n event.preventDefault();\n const url: URL = new URL((<HTMLAnchorElement>event.target).href);\n this.fileLinkClicked.emit(url);\n }\n\n private _elementFromString(markupStr: string): HTMLDivElement {\n // Renderer2 doesnt have a parsing method, so we have to sanitize and use [innerHTML]\n // to parse the string into DOM element for now.\n const div: HTMLDivElement = this._renderer.createElement('div');\n this._renderer.appendChild(this._elementRef.nativeElement, div);\n\n const html: string =\n this._domSanitizer.sanitize(\n SecurityContext.STYLE,\n changeStyleAlignmentToClass(markupStr),\n ) ?? '';\n\n const htmlWithAbsoluteHrefs: string = normalizeHtmlHrefs(\n html,\n this._hostedUrl,\n this._fileLinkExtensions,\n );\n const htmlWithAbsoluteImgSrcs: string = normalizeImageSrcs(\n htmlWithAbsoluteHrefs,\n this._hostedUrl,\n );\n const htmlWithHeadingIds: string = addIdsToHeadings(\n htmlWithAbsoluteImgSrcs,\n );\n const htmlWithVideos: SafeHtml = renderVideoElements(htmlWithHeadingIds);\n this._renderer.setProperty(div, 'innerHTML', htmlWithVideos);\n return div;\n }\n\n private _render(markdown: string): string {\n // Trim leading and trailing newlines\n markdown = markdown\n .replace(/^(\\s|\\t)*\\n+/g, '')\n .replace(/(\\s|\\t)*\\n+(\\s|\\t)*$/g, '');\n // Split markdown by line characters\n let lines: string[] = markdown.split('\\n');\n\n // check how much indentation is used by the first actual markdown line\n const firstLineWhitespaceMatch = lines[0].match(/^(\\s|\\t)*/);\n const firstLineWhitespace: string = firstLineWhitespaceMatch\n ? firstLineWhitespaceMatch[0]\n : '';\n\n // Remove all indentation spaces so markdown can be parsed correctly\n const startingWhitespaceRegex = new RegExp('^' + firstLineWhitespace);\n lines = lines.map(function (line: string): string {\n return line.replace(startingWhitespaceRegex, '');\n });\n\n // Join lines again with line characters\n const markdownToParse: string = lines.join('\\n');\n\n // Convert markdown into html\n const converter: showdown.Converter = new showdown.Converter();\n converter.setOption('ghCodeBlocks', true);\n converter.setOption('ghCompatibleHeaderId', true);\n converter.setOption('tasklists', true);\n converter.setOption('tables', true);\n converter.setOption('literalMidWordUnderscores', true);\n converter.setOption('simpleLineBreaks', this._simpleLineBreaks);\n converter.setOption('disableForced4SpacesIndentedSublists', true);\n converter.setOption('emoji', true);\n\n const markdownWithAttr: string = addMarkdownAttrToHtmlTags(markdownToParse);\n const html = converter.makeHtml(markdownWithAttr);\n return html;\n }\n}\n","<ng-content></ng-content>\n","import { Injectable, SecurityContext } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { HttpClient, HttpResponse } from '@angular/common/http';\nimport { isGithubHref, rawGithubHref } from '../markdown-utils/markdown-utils';\n\n@Injectable()\nexport class TdMarkdownLoaderService {\n constructor(private _http: HttpClient, private _sanitizer: DomSanitizer) {}\n\n async load(url: string, httpOptions: object = {}): Promise<string> {\n const sanitizedUrl: string =\n this._sanitizer.sanitize(SecurityContext.URL, url) ?? '';\n let urlToGet: string = sanitizedUrl;\n if (isGithubHref(sanitizedUrl)) {\n urlToGet = rawGithubHref(sanitizedUrl);\n }\n\n const response: HttpResponse<string> | undefined = await this._http\n .get(urlToGet, {\n ...httpOptions,\n responseType: 'text',\n observe: 'response',\n })\n .toPromise();\n const contentType: string = response?.headers.get('Content-Type') ?? '';\n if (\n contentType.includes('text/plain') ||\n contentType.includes('text/markdown')\n ) {\n return response?.body ?? '';\n } else {\n throw Error(`${contentType} is not a handled content type`);\n }\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport {\n provideHttpClient,\n withInterceptorsFromDi,\n} from '@angular/common/http';\n\nimport { TdMarkdownComponent } from './markdown.component';\nimport { TdMarkdownLoaderService } from './markdown-loader/markdown-loader.service';\n\n/**\n * @deprecated This module is deprecated and will be removed in future versions.\n * Please migrate to using standalone components as soon as possible.\n */\n@NgModule({\n exports: [TdMarkdownComponent],\n imports: [TdMarkdownComponent],\n providers: [\n TdMarkdownLoaderService,\n provideHttpClient(withInterceptorsFromDi()),\n ],\n})\nexport class CovalentMarkdownModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2"],"mappings":";;;;;;;AAAM,SAAU,iBAAiB,CAAC,GAAW,EAAA;IAC3C,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;AAEM,SAAU,kBAAkB,CAAC,GAAkB,EAAA;IACnD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;AAEM,SAAU,YAAY,CAAC,GAAW,EAAA;IACtC,IAAI,GAAG,EAAE;QACP,OAAO,iBAAiB,CACtB;AACG,aAAA,OAAO,CAAC,YAAY,EAAE,EAAE;;;;aAIxB,OAAO,CAAC,sCAAsC,EAAE,EAAE,CAAC,CACvD,CAAC,WAAW,EAAE;;AAEjB,IAAA,OAAO,EAAE;AACX;SAEgB,cAAc,CAC5B,KAAkB,EAClB,MAAc,EACd,SAAkB,EAAA;AAElB,IAAA,IAAI,KAAK,IAAI,MAAM,EAAE;AACnB,QAAA,MAAM,gBAAgB,GAAW,YAAY,CAAC,MAAM,CAAC;QACrD,IAAI,eAAe,GAAmB,IAAI;QAC1C,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAChD,CAAQ,KAAA,EAAA,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,CAAA,gBAAA,CAAA,EAAA,SAAA,EAAA;YACT,uBAAuB;YACvB,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAC5C,SAAA,EAAA,CAAA;;iFAEU,sBAAsB,EAAA,CAAA;cARlC,QAAQ;AAAC,QAAA,IAAA,EAAA,CAAA;gBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;gBAC9B,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC9B,gBAAA,SAAS,EAAE;oBACT,uBAAuB;oBACvB,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;AAC5C,iBAAA;AACF,aAAA;;wFACY,sBAAsB,EAAA,EAAA,OAAA,EAAA,CANvB,mBAAmB,CAAA,EAAA,OAAA,EAAA,CADnB,mBAAmB,CAAA,EAAA,CAAA,CAAA,EAAA,GAAA;;ACf/B;;AAEG;;;;"}
@@ -8,3 +8,11 @@ export declare function rawGithubHref(githubHref?: string): string;
8
8
  export declare function isGithubHref(href?: string): boolean;
9
9
  export declare function isRawGithubHref(href?: string): boolean;
10
10
  export declare function renderVideoElements(html: string): string;
11
+ /**
12
+ * Checks whether text contains markdown syntax patterns.
13
+ */
14
+ export declare function containsMarkdown(text: string): boolean;
15
+ /**
16
+ * Finds the index of the matching closing tag, handling nested same-name tags.
17
+ */
18
+ export declare function findClosingTagIndex(str: string, tagName: string, searchFrom: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@covalent/markdown",
3
- "version": "10.5.1",
3
+ "version": "10.5.3",
4
4
  "description": "Teradata UI Platform Markdown Module",
5
5
  "keywords": [
6
6
  "angular",