# Markdown

The **Markdown** component displays formatted Markdown content using Element styles.

## Usage

Markdown is a plain text formatting syntax where structure is written with ordinary characters: `#` for a heading, `**text**` for bold, `-` for a list item, etc.

The component maps these elements to Element text styles and spacing, ensuring rendered content is consistent with the rest of the product.

Optional features such as syntax highlighting, diagrams, math, and custom renderers can be enabled when needed.

![Markdown renderer](<../images/markdown-renderer.png>)

## When to use

- For [AI/chat](<https://element.siemens.io/components/chat-messages/chat-message/>) responses
- Rich text from users, such as comments, descriptions, and documentation
- For generated content such as reports, summaries, instructions, and release notes
- Imported Markdown content, such as .md files or Markdown based documentation

## Code

> **Note:** The markdown component is currently experimental and may undergo changes in future releases.

The `si-markdown` component renders Markdown content as Angular components. Use its options to configure extensions, code highlighting, and custom rendering behavior. Options can, and where possible should, be shared between multiple component instances.

Create the options once and pass the same instance to each `si-markdown` component that needs the configuration. The component supports GitHub Flavored Markdown by default, including tables, task lists, strikethrough, and autolinked URLs.

```
import { Component, signal } from '@angular/core';
import { makeSiMarkdownOptions, SiMarkdownComponent } from '@siemens/element-ng/markdown';
import { siMarkdownMathKaTeX } from '@siemens/element-ng/markdown/extensions/katex';
import { siMarkdownMermaid } from '@siemens/element-ng/markdown/extensions/mermaid';
import { siMarkdownHighlightJs } from '@siemens/element-ng/markdown/hightlighter/highlightjs';
import remarkGemoji from 'remark-gemoji';

@Component({
  imports: [SiMarkdownComponent],
  template: ` <si-markdown [markdown]="markdown()" [options]="markdownOptions" /> `
})
export class MarkdownExampleComponent {
  protected readonly markdown = signal('# Release notes');
  protected readonly markdownOptions = makeSiMarkdownOptions()
    .setCodeHighlighter(siMarkdownHighlightJs({ autoDetectLanguage: true }))
    .installExtension(siMarkdownMathKaTeX())
    .installExtension(siMarkdownMermaid())
    .installUnifiedPlugin(remarkGemoji);
}
```

### Code highlighting

Configure syntax highlighting for fenced code blocks with `siMarkdownHighlightJs()` and `.setCodeHighlighter()`. The highlighter includes JavaScript, TypeScript, JSON, CSS, SCSS, Bash, Python, and XML languages (also HTML) by default.

Use `languageLoader` to load other languages only when a code block requests them. The loader receives the language name from the fence and returns the corresponding Highlight.js language module. Return `undefined` for languages your application does not support.

```
import {
  siMarkdownHighlightJs,
  type HighlightJSLanguageImport
} from '@siemens/element-ng/markdown/hightlighter/highlightjs';

const highlightJsLanguageLoader = async (language: string): HighlightJSLanguageImport => {
  switch (language) {
    case 'c':
      return import('highlight.js/lib/languages/c');
    case 'cpp':
      return import('highlight.js/lib/languages/cpp');
    case 'yaml':
      return import('highlight.js/lib/languages/yaml');
    default:
      return undefined;
  }
};

protected readonly markdownOptions = makeSiMarkdownOptions().setCodeHighlighter(
  siMarkdownHighlightJs({ languageLoader: highlightJsLanguageLoader })
);
```

When `autoDetectLanguage` is enabled, Highlight.js can only detect languages that have already been registered; it does not invoke `languageLoader`. Eagerly register every language you want to auto-detect, following the built-in language registration used by the Highlight.js component:

```
import hljs from 'highlight.js/lib/core';
import langYaml from 'highlight.js/lib/languages/yaml';

hljs.registerLanguage('yaml', langYaml);

protected readonly markdownOptions = makeSiMarkdownOptions().setCodeHighlighter(
  siMarkdownHighlightJs({ autoDetectLanguage: true })
);
```

### Extensions

The following rendering support is included in every Markdown component:

| Rendering support | Purpose |
| --- | --- |
| GitHub Flavored Markdown | Parses tables, task lists, strikethrough, and autolinked URLs. |
| Inline HTML | Renders sanitized inline HTML. |
| Code blocks | Renders fenced code blocks without syntax highlighting. |

Optional integrations are configured through `SiMarkdownOptions`:

| Integration | Configuration | Purpose |
| --- | --- | --- |
| [KaTeX](<https://katex.org/>) | `.installExtension(siMarkdownMathKaTeX())` | Parses and renders inline and block LaTeX math expressions. It accepts optional `remark-math` parser and KaTeX rendering options. |
| [Mermaid](<https://mermaid.js.org/>) | `.installExtension(siMarkdownMermaid())` | Renders fenced code blocks declared as `mermaid` as diagrams. It accepts optional Mermaid configuration. |
| [Highlight.js](<https://highlightjs.org/>) | `.setCodeHighlighter(siMarkdownHighlightJs())` | Adds syntax highlighting to fenced code blocks. It accepts Highlight.js options, including automatic language detection. |
| [Gemojis](<https://github.com/github/gemoji>) | `.installUnifiedPlugin(remarkGemoji)` | Converts emoji shortcodes such as `:rocket:` to emoji. |

You can also add a compatible [unified](<https://unifiedjs.com/>) or [remark](<https://remark.js.org/>) plugin with `.installUnifiedPlugin(plugin, options)`. This is useful for syntax that is not covered by the Element integrations, such as emoji shortcodes.

> **Bundle size:** KaTeX, Mermaid, Highlight.js, and additional `unified` plugins increase the application bundle size. Import and configure only the integrations your Markdown content requires.

#### Mermaid security considerations

Keep Mermaid configuration in trusted application code. When rendering diagrams from users, external services, or AI-generated responses, keep the default [`securityLevel: 'strict'`](<https://mermaid.js.org/config/schema-docs/config.html#securitylevel>).

The Mermaid integration uses shared global configuration: options passed to `siMarkdownMermaid()` can affect other diagram renders using the same Mermaid instance. Separate `si-markdown` components or options objects do not provide configuration isolation. Use a consistent strict configuration throughout the application, and do not mix permissive Mermaid configuration with untrusted diagram rendering. Do not rely on Angular's HTML sanitization to compensate for permissive settings: the integration trusts Mermaid's generated SVG output.

#### KaTeX security considerations

Keep the default [`trust: false`](<https://katex.org/docs/options.html>) when rendering expressions from users, external services, or AI-generated responses. This setting disables commands that can create links, load external images, or add HTML attributes.

Do not set `trust: true` unless all expressions rendered with that configuration come from sources you fully trust, such as application-controlled content. Do not enable it for user-provided, externally supplied, or AI-generated expressions. If specific commands are required for untrusted expressions, use a narrowly scoped `trust` callback that validates both the command and its arguments, including URLs. Keep KaTeX configuration in trusted application code. KaTeX renders directly into the DOM, so Angular's HTML sanitization does not provide an additional safeguard for these settings.

### Directives

Directives add named, component-backed elements to Markdown. The renderer supports the directive syntax provided by [`remark-directive`](<https://github.com/remarkjs/remark-directive>): inline directives use `:name[label]{attributes}`, leaf directives use `::name{attributes}`, and container directives wrap Markdown content with matching colon fences, at least three colons.

```
:::name{attribute=value attribute2=value2}
Normal **Markdown** content.
:::
```

Register a directive handler with `registerDirective()`. A handler maps a directive name to an Angular component that implements `SiMarkdownExtensionComponent`; that component receives the parsed directive node, its parent, and any registered options as signal inputs.

Example:

```
::notice{message="Scheduled maintenance starts at 22:00."}
```

```
import { Component, input } from '@angular/core';
import {
  makeSiMarkdownOptions,
  type SiMarkdownDirectiveNode,
  type SiMarkdownExtensionComponent
} from '@siemens/element-ng/markdown';
import { type Node, type Parent } from 'mdast';

@Component({
  selector: 'si-markdown-notice',
  template: '<div class="notice">{{ node().attributes.message }}</div>'
})
class MarkdownNoticeComponent implements SiMarkdownExtensionComponent {
  readonly node = input.required<SiMarkdownDirectiveNode>();
  readonly parent = input.required<Parent>();
  readonly options = input<unknown>();
}

protected readonly markdownOptions = makeSiMarkdownOptions().registerDirective({
  type: 'notice',
  component: MarkdownNoticeComponent
});
```

#### Callout

The `callout` container directive is integrated by default. Use its optional `type` attribute to choose a visual severity: `success`, `info`, `warning`, `danger`, `caution`, `critical`, `note`, or `tip`. `note` is the default.

```
:::callout{type=warning heading="Optional heading"}
This action cannot be undone.
:::
```

#### Tabs

The tabset directive is an opt-in directive that adds Element tabset. Register `siMarkdownTabsetDirective()` to enable the `tabset` container directive. Its child `tab` directives map to `si-tab`; only their `heading` attribute is used. Use a longer fence for the outer `tabset` when nesting `tab` directives.

```
import { makeSiMarkdownOptions } from '@siemens/element-ng/markdown';
import { siMarkdownTabsetDirective } from '@siemens/element-ng/markdown/directives/tabs';

protected readonly markdownOptions = makeSiMarkdownOptions().registerDirective(
  siMarkdownTabsetDirective()
);
```

```
::::tabset{height=12rem}
:::tab{heading="First tab"}
First tab content.
:::

:::tab{heading="Second tab"}
Second tab content.
:::
::::
```

Supported attribute on `::::tabset` is `height`. It can be any CSS length unit or `auto` to take up the space needed for the active tab.

### Custom extension

An extension can install `unified` plugin(s) and associate the AST node types produced by that plugin with Angular renderer components. As an example, the following provides an alternative to render LaTeX math expressions. Instead of using KaTeX it uses `@webc.site/math`. This package is smaller and faster than KaTeX, but can only produce MathML (supported by all major browsers). It is distributed under the `MulanPSL-2.0`, an OSI approved liberal license.

```
import remarkMath, { type Options } from 'remark-math';

import { SiMarkdownExtension } from '../../si-markdown.types';
import { SiMarkdownMathComponent } from './si-markdown-math.component';

export const siMarkdownWebcSiteMath = (parseOptions?: Options): SiMarkdownExtension => {
  return {
    plugins: [{ plugin: remarkMath, options: parseOptions }],
    types: [
      { type: 'math', component: SiMarkdownMathComponent },
      { type: 'inlineMath', component: SiMarkdownMathComponent }
    ]
  };
};
```

The renderer implements `SiMarkdownExtensionComponent`. Element supplies the parsed node, its parent, and the options provided in the extension definition as signal inputs.

```
import { Component, computed, inject, input } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import mathml from '@webc.site/math';
import { Literal, type Node, type Parent } from 'mdast';

import { SiMarkdownExtensionComponent } from '../../si-markdown.types';

@Component({
  selector: 'si-markdown-math',
  template: '',
  host: {
    '[attr.data-line]': 'node().position?.start?.line',
    '[class.d-block]': 'displayMode()',
    '[innerHTML]': 'html()'
  }
})
export class SiMarkdownMathComponent implements SiMarkdownExtensionComponent {
  private readonly sanitizer = inject(DomSanitizer);

  readonly node = input.required<Node>();
  readonly parent = input.required<Parent>();
  readonly options = input<any>();

  protected readonly displayMode = computed(() => this.node().type === 'math');
  protected readonly html = computed(() => {
    const expr = (this.node() as Literal).value;
    const html = mathml(expr, this.displayMode());
    return this.sanitizer.bypassSecurityTrustHtml(html);
  });
}
```

Register the extension with the component options:

```
protected readonly markdownOptions = makeSiMarkdownOptions().installExtension(siMarkdownWebcSiteMath());
```

### Example

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { JsonPipe } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, computed, ElementRef, inject, OnInit, signal, viewChild } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SiAccordionComponent, SiCollapsiblePanelComponent } from '@siemens/element-ng/accordion';
import { SiFormItemComponent } from '@siemens/element-ng/form';
import {
  makeSiMarkdownOptions,
  SiMarkdownCitation,
  SiMarkdownComponent
} from '@siemens/element-ng/markdown';
import { siMarkdownTabsetDirective } from '@siemens/element-ng/markdown/directives/tabs';
import { siMarkdownCitations } from '@siemens/element-ng/markdown/extensions/citations';
import { siMarkdownMathKaTeX } from '@siemens/element-ng/markdown/extensions/katex';
import { siMarkdownMermaid } from '@siemens/element-ng/markdown/extensions/mermaid';
import { siMarkdownHighlightJs } from '@siemens/element-ng/markdown/hightlighter/highlightjs';
import { SiNumberInputComponent } from '@siemens/element-ng/number-input';
import { LOG_EVENT } from '@siemens/live-preview';
import remarkGemoji from 'remark-gemoji';

interface ScrollMapPoint {
  sourceTop: number;
  outputTop: number;
}

const positionCitationMarker = '[position-citation]';

@Component({
  selector: 'app-sample',
  imports: [
    FormsModule,
    JsonPipe,
    SiMarkdownComponent,
    SiNumberInputComponent,
    SiFormItemComponent,
    SiAccordionComponent,
    SiCollapsiblePanelComponent
  ],
  templateUrl: './si-markdown.html'
})
export class SampleComponent implements OnInit {
  private readonly http = inject(HttpClient);
  protected logEvent = inject(LOG_EVENT);

  protected readonly markdownOptions = computed(() => {
    const opts = makeSiMarkdownOptions();
    if (this.useHighlightJs()) {
      opts.setCodeHighlighter(siMarkdownHighlightJs({ autoDetectLanguage: this.autoDetectLang() }));
    }
    if (this.useCitations()) {
      opts.installExtension(siMarkdownCitations());
    }
    if (this.useKatex()) {
      opts.installExtension(
        // can pass options to KaTeX here. E.g. default rendering is HTML only (speed)
        siMarkdownMathKaTeX(undefined, { output: 'htmlAndMathml' })
      );
    }
    if (this.useMermaid()) {
      opts.installExtension(siMarkdownMermaid());
    }
    if (this.useGemojis()) {
      opts.installUnifiedPlugin(remarkGemoji);
    }
    if (this.useTabsetDirective()) {
      opts.registerDirective(siMarkdownTabsetDirective());
    }

    return opts;
  });

  private readonly lorem =
    'Lorem ipsum, dolor sit amet consectetur adipisicing elit. Non ab amet architecto aspernatur corrupti harum hic, vero ducimus cumque eos delectus doloribus.';
  protected readonly markdownText = signal<string>('');
  protected readonly markdownTextForRenderer = signal<string>('');
  protected readonly citations = computed<SiMarkdownCitation[]>(() => {
    const markdown = this.markdownText();
    const positionStart = markdown.indexOf(positionCitationMarker);
    const citations: SiMarkdownCitation[] = [
      {
        identifier: 'reference-citation',
        name: 'Reference citation',
        url: 'https://element.siemens.io',
        description: 'This is a reference to the Element home page.'
      },
      {
        identifier: 'citation-one',
        name: 'First source with long name',
        url: 'https://example.com/1',
        description: this.lorem
      },
      {
        identifier: 'citation-two',
        name: 'Second source',
        url: 'https://example.com/2',
        description: this.lorem
      },
      {
        identifier: 'citation-three',
        name: 'Third source',
        url: 'https://example.com/3',
        description: this.lorem
      }
    ];

    if (positionStart !== -1) {
      citations.push({
        name: 'Position citation',
        url: 'https://example.com/position',
        description: this.lorem,
        position: {
          startIndex: positionStart,
          endIndex: positionStart + positionCitationMarker.length
        }
      });
    }

    return citations;
  });
  protected readonly streaming = signal(false);
  protected readonly streamIterationDelay = signal(30);
  protected readonly streamCharsPerIteration = signal(15);
  protected readonly keepScrollBottom = signal(false);
  protected readonly scrollSync = signal(true);

  protected readonly useHighlightJs = signal(true);
  protected readonly autoDetectLang = signal(true);
  protected readonly useCitations = signal(true);
  protected readonly useKatex = signal(true);
  protected readonly useMermaid = signal(true);
  protected readonly useGemojis = signal(true);
  protected readonly useTabsetDirective = signal(true);
  protected readonly debug = signal(false);

  private readonly textarea = viewChild.required<ElementRef<HTMLTextAreaElement>>('textarea');
  private readonly renderedOutput = viewChild.required<ElementRef<HTMLElement>>('renderedOutput');
  private scrollMap?: [key: string, points: ScrollMapPoint[]];
  private syncingElement?: HTMLElement;

  ngOnInit(): void {
    this.http.get('assets/sample-markdown-ext.md', { responseType: 'text' }).subscribe(text => {
      this.markdownText.set(text);
      this.updateRenderer();
    });
  }

  protected updateRenderer(): void {
    if (!this.streaming()) {
      this.markdownTextForRenderer.set(this.markdownText());
    }
  }

  protected start(): void {
    this.streaming.set(true);
    this.streamTextToRenderer();
  }

  protected stop(): void {
    this.streaming.set(false);
    this.updateRenderer();
  }

  private async streamTextToRenderer(): Promise<void> {
    this.markdownTextForRenderer.set('');

    const delay = this.streamIterationDelay();
    const chars = this.streamCharsPerIteration();
    const text = this.markdownText();

    let forRenderer = '';

    while (text.length > forRenderer.length && this.streaming()) {
      forRenderer += text.substring(forRenderer.length, forRenderer.length + chars);
      this.markdownTextForRenderer.set(forRenderer);
      await new Promise(resolve => setTimeout(resolve, delay));
    }
    this.streaming.set(false);
  }

  /* AI generated sync scrolling below */

  protected syncScroll(sourceKey: keyof ScrollMapPoint, targetKey: keyof ScrollMapPoint): void {
    const textarea = this.textarea().nativeElement;
    const output = this.renderedOutput().nativeElement;
    const source = sourceKey === 'sourceTop' ? textarea : output;
    const target = targetKey === 'sourceTop' ? textarea : output;
    if (!this.scrollSync() || this.streaming() || this.syncingElement === source) {
      return;
    }

    const points = this.getScrollMap(textarea, output);
    const sourceTop =
      sourceKey === 'outputTop' ? this.getOutputScrollTop(output) : source.scrollTop;
    const targetTop = this.interpolateScrollPosition(points, sourceTop, sourceKey, targetKey);
    const toPosition =
      targetKey === 'outputTop'
        ? this.keepScrollBottom()
          ? targetTop - output.scrollHeight + output.clientHeight
          : targetTop
        : targetTop;
    this.scrollTo(target, toPosition);
  }

  private getScrollMap(textarea: HTMLTextAreaElement, output: HTMLElement): ScrollMapPoint[] {
    const key = JSON.stringify([
      textarea.value,
      textarea.clientWidth,
      textarea.scrollHeight,
      textarea.clientHeight,
      output.clientWidth,
      output.scrollHeight,
      output.clientHeight,
      this.keepScrollBottom()
    ]);
    if (this.scrollMap?.[0] === key) {
      return this.scrollMap[1];
    }

    const sourceLineOffsets = this.getSourceLineOffsets(textarea);
    const sourceMaxScrollTop = textarea.scrollHeight - textarea.clientHeight;
    const outputMaxScrollTop = output.scrollHeight - output.clientHeight;
    const points: ScrollMapPoint[] = [{ sourceTop: 0, outputTop: 0 }];

    for (const anchor of this.getLineAnchors(output)) {
      const sourceTop = sourceLineOffsets[anchor.line - 1];
      const previous = points.at(-1)!;
      if (
        sourceTop !== undefined &&
        sourceTop < sourceMaxScrollTop &&
        anchor.top < outputMaxScrollTop &&
        sourceTop > previous.sourceTop &&
        anchor.top > previous.outputTop
      ) {
        points.push({ sourceTop, outputTop: anchor.top });
      }
    }

    points.push({ sourceTop: sourceMaxScrollTop, outputTop: outputMaxScrollTop });
    this.scrollMap = [key, points];
    return points;
  }

  private interpolateScrollPosition(
    points: ScrollMapPoint[],
    value: number,
    sourceKey: keyof ScrollMapPoint,
    targetKey: keyof ScrollMapPoint
  ): number {
    const next = points.find(point => point[sourceKey] >= value);
    if (!next) {
      return points.at(-1)?.[targetKey] ?? 0;
    }

    const previous = points.findLast(point => point[sourceKey] <= value);
    if (!previous || previous[sourceKey] === next[sourceKey]) {
      return next[targetKey];
    }

    const progress = (value - previous[sourceKey]) / (next[sourceKey] - previous[sourceKey]);
    return previous[targetKey] + (next[targetKey] - previous[targetKey]) * progress;
  }

  private getLineAnchors(output: HTMLElement): { line: number; top: number }[] {
    const outputTop = output.getBoundingClientRect().top;
    return Array.from(output.querySelectorAll<HTMLElement>('[data-line]'))
      .filter(
        element => !element.closest('.footnotes') && !element.parentElement?.closest('[data-line]')
      )
      .map(element => ({
        line: Number(element.dataset.line),
        top: element.getBoundingClientRect().top - outputTop + this.getOutputScrollTop(output)
      }))
      .filter(anchor => Number.isInteger(anchor.line))
      .toSorted((first, second) => first.line - second.line || first.top - second.top);
  }

  private getOutputScrollTop(output: HTMLElement): number {
    return this.keepScrollBottom()
      ? output.scrollTop + output.scrollHeight - output.clientHeight
      : output.scrollTop;
  }

  private getSourceLineOffsets(textarea: HTMLTextAreaElement): number[] {
    const styles = getComputedStyle(textarea);
    const mirror = document.createElement('div');
    Object.assign(mirror.style, {
      position: 'absolute',
      visibility: 'hidden',
      pointerEvents: 'none',
      left: '-10000px',
      top: '0',
      width: `${textarea.clientWidth}px`,
      boxSizing: 'border-box',
      padding: styles.padding,
      font: styles.font,
      letterSpacing: styles.letterSpacing,
      lineHeight: styles.lineHeight,
      whiteSpace: 'pre-wrap',
      overflowWrap: 'break-word',
      wordBreak: 'break-word'
    });

    const lines = textarea.value.split('\n');
    const lineElements = lines.map((line, index) => {
      const element = document.createElement('span');
      element.textContent = line || '\u200b';
      mirror.append(element);
      if (index < lines.length - 1) {
        mirror.append(document.createElement('br'));
      }
      return element;
    });

    document.body.append(mirror);
    const firstLineTop = lineElements[0].offsetTop;
    const offsets = lineElements.map(element => element.offsetTop - firstLineTop);
    mirror.remove();
    return offsets;
  }

  private scrollTo(element: HTMLElement, scrollTop: number): void {
    if (Math.abs(element.scrollTop - scrollTop) < 1) {
      return;
    }

    this.syncingElement = element;
    element.scrollTop = scrollTop;
    requestAnimationFrame(() => {
      if (this.syncingElement === element) {
        this.syncingElement = undefined;
      }
    });
  }
}
```

Template:

```html
<div class="d-flex flex-column h-100">
  <si-accordion class="e2e-ignore">
    <si-collapsible-panel
      heading="Options"
      contentCssClasses="px-6 pb-5 pt-4 d-flex gap-5 align-items-end"
    >
      <si-form-item label="Use citations" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useCitations" />
      </si-form-item>
      <si-form-item label="Use Highlight.js" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useHighlightJs" />
      </si-form-item>
      <si-form-item label="Auto-detect language" class="mb-0 py-4">
        <input
          type="checkbox"
          class="form-check-input"
          [disabled]="!useHighlightJs()"
          [(ngModel)]="autoDetectLang"
        />
      </si-form-item>
      <si-form-item label="Use KaTeX" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useKatex" />
      </si-form-item>
      <si-form-item label="Use Mermaid" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useMermaid" />
      </si-form-item>
      <si-form-item label="Support Gemojis" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useGemojis" />
      </si-form-item>
      <si-form-item label="Tabset directive" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="useTabsetDirective" />
      </si-form-item>
      <si-form-item label="Debug" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="debug" />
      </si-form-item>
      <si-form-item label="Scroll sync" class="mb-0 py-4">
        <input
          type="checkbox"
          class="form-check-input"
          [disabled]="streaming()"
          [(ngModel)]="scrollSync"
        />
      </si-form-item>
    </si-collapsible-panel>
    <si-collapsible-panel
      heading="Streaming"
      contentCssClasses="px-6 pb-5 pt-4 d-flex gap-5 align-items-end"
    >
      <si-form-item label="Iteration delay (ms)" class="mb-0">
        <si-number-input
          class="form-control"
          [min]="1"
          [max]="100"
          [step]="1"
          [(ngModel)]="streamIterationDelay"
        />
      </si-form-item>
      <si-form-item label="Chars per iteration" class="mb-0">
        <si-number-input
          class="form-control"
          [min]="1"
          [max]="100"
          [step]="1"
          [(ngModel)]="streamCharsPerIteration"
        />
      </si-form-item>
      <si-form-item label="Keep scroll at bottom" class="mb-0 py-4">
        <input type="checkbox" class="form-check-input" [(ngModel)]="keepScrollBottom" />
      </si-form-item>

      @if (streaming()) {
        <button type="button" class="btn btn-secondary" (click)="stop()">Stop streaming</button>
      } @else {
        <button type="button" class="btn btn-secondary" (click)="start()">Start streaming</button>
      }
    </si-collapsible-panel>
    <si-collapsible-panel heading="Citations" contentCssClasses="px-6 pb-5 pt-4">
      <pre class="m-0" style="max-block-size: 300px">{{ citations() | json }}</pre>
    </si-collapsible-panel>
  </si-accordion>

  <div class="flex-fill d-flex">
    <div class="col-6 p-4">
      <textarea
        #textarea
        aria-label="Markdown input"
        class="w-100 h-100 form-control"
        style="resize: none"
        [readonly]="streaming()"
        [(ngModel)]="markdownText"
        (ngModelChange)="updateRenderer()"
        (scroll)="syncScroll('sourceTop', 'outputTop')"
      ></textarea>
    </div>
    <div class="col-6 d-flex flex-column">
      <div
        #renderedOutput
        class="d-flex p-4 overflow-auto"
        style="flex: 1 1 0"
        [class.flex-column-reverse]="keepScrollBottom()"
        (scroll)="syncScroll('outputTop', 'sourceTop')"
      >
        <si-markdown
          class="flex-fill"
          [markdown]="markdownTextForRenderer()"
          [options]="markdownOptions()"
          [citations]="citations()"
          [debug]="debug()"
          (extensionEvent)="logEvent($event)"
        />
      </div>
    </div>
  </div>
</div>
```

### [SiMarkdownComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L51-L124>)

**Kind:** component

**Selector:** `si-markdown`

```
import { SiMarkdownComponent } from '@siemens/element-ng/markdown';
```

Component to display markdown text

This component is built using concepts from [ngx-remark](<https://github.com/ericleib/ngx-remark>), namely using Angular templates to render the AST produced by `remark`.

Unlike `ngx-remark`, it features a configuration based approach of extensibility so that multiple instances of the component can be used with the same configuration, e.g. inside a chat component w/o repeating templates.

```
component SiMarkdownComponent implements SiMarkdownControl
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [citations](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L64-L64>) | `SiMarkdownCitation[] \| undefined` |  | Citation metadata used to create citations. |
| [debug](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L70-L70>) | `boolean` | `false` | Debug mode. When true, unknown node types will be displayed along with the node as JSON.<br><br>Implements [SiMarkdownControl](<index.html#t:SiMarkdownControl>) |
| [markdown](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L58-L58>) | `string` | `''` | The markdown text to transform and display |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L62-L62>) | `SiMarkdownOptions \| undefined` |  | Options to control rendering. Can be shared across multiple instances. |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [extensionEvent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L73-L73>) | `{ name: string; data: any; }` | Emitted by extension components.<br><br>Implements [SiMarkdownControl](<index.html#t:SiMarkdownControl>) |

#### Attributes and Methods

##### meta

[Source for meta](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.component.ts#L102-L102>)

**Modifiers:** readonly

**Type:** `Signal<SiMarkdownMetadata>`

**Default:** `computed<SiMarkdownMetadata>(() => ({ citations: this.citations() }))`

Gives access to metadata in extension components

Implements [SiMarkdownControl](<index.html#t:SiMarkdownControl>)

### Types Documentation

### [SiMarkdownCitation](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L89-L97>)

**Kind:** interface

```
import type { SiMarkdownCitation } from '@siemens/element-ng/markdown';
```

Citation metadata associated with a markdown response.

```
interface SiMarkdownCitation extends SourceReference
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [description](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L13-L13>) (optional, inherited) | `string` | Optional source description.<br><br>Inherited from [SourceReference](<index.html#t:SourceReference>) |
| [identifier](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L91-L91>) (optional) | `string` | Identifier referenced by bracket notation, such as `[source-1]`. |
| [name](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L9-L9>) (inherited) | `string` | Source name displayed to the user.<br><br>Inherited from [SourceReference](<index.html#t:SourceReference>) |
| [position](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L93-L96>) (optional) | `{ startIndex: number; endIndex: number; }` | Zero-based, end-exclusive source range of the citation reference in the markdown source. |
| [quote](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L15-L15>) (optional, inherited) | `string` | Optional source quote. Takes precedence over [description](<index.html#t:SiMarkdownCitation.description>).<br><br>Inherited from [SourceReference](<index.html#t:SourceReference>) |
| [url](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L11-L11>) (inherited) | `string` | Source URL.<br><br>Inherited from [SourceReference](<index.html#t:SourceReference>) |

### [SiMarkdownOptions](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L47-L158>)

**Kind:** class

```
import { SiMarkdownOptions } from '@siemens/element-ng/markdown';
```

Options for the markdown renderer. This holds all configuration and allows installing extensions. A number of extensions are already ready to use and shipped with Element.

Example:

```ts
import { siMarkdownMathKaTeX } from '@siemens/element-ng/markdown/extensions/math';
import remarkGemoji from 'remark-gemoji';

protected markdownOptions = new SiMarkdownOptions()
  .installExtension(siMarkdownMathKaTeX())
  .installUnifiedPlugin(remarkGemoji);
```

```html
<si-markdown [markdown]="markdownText()" [options]="markdownOptions" />
```

```
undecorated_class SiMarkdownOptions
```

#### Constructor

##### constructor

[Source for constructor](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L54-L61>)

```
constructor(): SiMarkdownOptions
```

**Returns:** [SiMarkdownOptions](<index.html#t:SiMarkdownOptions>)

#### Methods

##### getCodeTypeHandlers

[Source for getCodeTypeHandlers](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L148-L150>)

Returns: All code type handlers

```
getCodeTypeHandlers(): Map<string, TypeHandler>
```

**Returns:** [Map](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map>)`<`[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`, `[TypeHandler](<index.html#t:TypeHandler>)`>`

##### getHighlighter

[Source for getHighlighter](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L155-L157>)

Returns: The highlighter

```
getHighlighter(): SiMarkdownHighlighter | undefined
```

**Returns:** [SiMarkdownHighlighter](<index.html#t:SiMarkdownHighlighter>)`  |  `[undefined](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined>)

##### getTypeHandlers

[Source for getTypeHandlers](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L141-L143>)

Returns: All type handlers

```
getTypeHandlers(): TypeHandler[]
```

**Returns:** [TypeHandler](<index.html#t:TypeHandler>)`[]`

##### installExtension

[Source for installExtension](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L94-L110>)

Installs a extension which can contain plugins, type handlers

Returns: self for chaining

```
installExtension(extension: SiMarkdownExtension): SiMarkdownOptions
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [extension](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L94-L94>) | `SiMarkdownExtension` |  | • The extension definition |

**Returns:** [SiMarkdownOptions](<index.html#t:SiMarkdownOptions>)

##### installUnifiedPlugin

[Source for installUnifiedPlugin](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L69-L72>)

Installs a plugin into the `unified` chain

Returns: self for chaining

```
installUnifiedPlugin(plugin: UnifiedPlugin, options?: any): SiMarkdownOptions
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [plugin](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L69-L69>) | `UnifiedPlugin` |  | • The `unified` plugin |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L69-L69>) (optional) | `any` |  | • Options for the plugin |

**Returns:** [SiMarkdownOptions](<index.html#t:SiMarkdownOptions>)

##### makeProcessor

[Source for makeProcessor](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L125-L136>)

Creates the `unified` processor with all plugins and options

Returns: `unified` processor

```
makeProcessor(meta: SiMarkdownMetadata): Processor<Root, Root, SiMarkdownRoot, undefined, undefined>
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [meta](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L126-L126>) | `SiMarkdownMetadata` |  |  |

**Returns:** [Processor](<https://unifiedjs.com>)`<`[Root](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>)`, `[Root](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>)`, `[SiMarkdownRoot](<index.html#t:SiMarkdownRoot>)`, `[undefined](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined>)`, `[undefined](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined>)`>`

##### registerDirective

[Source for registerDirective](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L79-L87>)

Registers a component used to render a named Markdown directive.

Returns: self for chaining

```
registerDirective(directives: TypeHandler | TypeHandler[]): SiMarkdownOptions
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [directives](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L79-L79>) | `TypeHandler \| TypeHandler[]` |  |  |

**Returns:** [SiMarkdownOptions](<index.html#t:SiMarkdownOptions>)

##### setCodeHighlighter

[Source for setCodeHighlighter](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L116-L119>)

Sets the code highlighter

```
setCodeHighlighter(highlighter?: SiMarkdownHighlighter): SiMarkdownOptions
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [highlighter](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-options.ts#L116-L116>) (optional) | `SiMarkdownHighlighter` |  | • The highlighter |

**Returns:** [SiMarkdownOptions](<index.html#t:SiMarkdownOptions>)

### [SiMarkdownControl](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-token.ts#L17-L22>)

**Kind:** interface

```
import type { SiMarkdownControl } from '@siemens/element-ng/markdown';
```

Interface of si-markdown exposed to children.

```
interface SiMarkdownControl
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [debug](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-token.ts#L20-L20>) | `Signal<boolean>` |  |
| [extensionEvent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-token.ts#L21-L21>) | `OutputEmitterRef<{ name: string; data: any; }>` |  |
| [meta](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-token.ts#L19-L19>) | `Signal<SiMarkdownMetadata>` |  |
| [templates](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown-token.ts#L18-L18>) | `Signal<Map<string, TemplateRef<any>>>` |  |

### [SiMarkdownMetadata](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L100-L102>)

**Kind:** interface

```
import type { SiMarkdownMetadata } from '@siemens/element-ng/markdown';
```

Options passed to makeProcessor()

```
interface SiMarkdownMetadata
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [citations](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L101-L101>) (optional) | `SiMarkdownCitation[]` |  |

### [UnifiedPlugin](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L64-L64>)

**Kind:** type alias

```
import type { UnifiedPlugin } from '@siemens/element-ng/markdown';
```

```
type UnifiedPlugin = Plugin<any> | Transformer<any> | Preset | PluggableList
```

### [TypeHandler](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L48-L51>)

**Kind:** interface

```
import type { TypeHandler } from '@siemens/element-ng/markdown';
```

Type handler for a named type. This can be an AST node type, a code type, a directive name

```
interface TypeHandler extends ComponentWithOptions<SiMarkdownExtensionComponent>
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [component](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L42-L42>) (inherited) | `Type<SiMarkdownExtensionComponent>` | The component used to render the node<br><br>Inherited from [ComponentWithOptions\<SiMarkdownExtensionComponent\>](<index.html#t:ComponentWithOptions>) |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L44-L44>) (optional, inherited) | `any` | Options passed to the component<br><br>Inherited from [ComponentWithOptions\<SiMarkdownExtensionComponent\>](<index.html#t:ComponentWithOptions>) |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L50-L50>) | `string` | Type name |

### [SiMarkdownExtension](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L77-L86>)

**Kind:** interface

```
import type { SiMarkdownExtension } from '@siemens/element-ng/markdown';
```

An extension to the si-markdown component

```
interface SiMarkdownExtension
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [codeTypes](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L83-L83>) (optional) | `TypeHandler[]` | Special code type handlers to install |
| [directives](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L85-L85>) (optional) | `TypeHandler[]` | Directives |
| [plugins](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L79-L79>) (optional) | `PluginWithOptions[]` | `unified` plugins to install |
| [types](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L81-L81>) (optional) | `TypeHandler[]` | Type handlers to install |

### [SiMarkdownHighlighter](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L62-L62>)

**Kind:** type alias

```
import type { SiMarkdownHighlighter } from '@siemens/element-ng/markdown';
```

```
type SiMarkdownHighlighter = ComponentWithOptions<SiMarkdownHighlighterComponent>
```

### [SiMarkdownRoot](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L127-L133>)

**Kind:** type alias

```
import type { SiMarkdownRoot } from '@siemens/element-ng/markdown';
```

Extended root with references

```
type SiMarkdownRoot = Omit<Root, 'children'> & {
  children: ExtendedRootContent[];
  references?: {
    footnoteDefinitions?: Map<string, FootnoteDefinition>;
    definitions?: Map<string, Definition>;
  };
}
```

### [SourceReference](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L7-L16>)

**Kind:** interface

```
import type { SourceReference } from '@siemens/element-ng/source-chip';
```

Definition of a single source

```
interface SourceReference
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [description](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L13-L13>) (optional) | `string` | Optional source description. |
| [name](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L9-L9>) | `string` | Source name displayed to the user. |
| [quote](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L15-L15>) (optional) | `string` | Optional source quote. Takes precedence over [description](<index.html#t:SourceReference.description>). |
| [url](<https://github.com/siemens/element/blob/main/projects/element-ng/source-chip/si-source-chip.model.ts#L11-L11>) | `string` | Source URL. |

### [SiMarkdownExtensionComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L18-L25>)

**Kind:** interface

```
import type { SiMarkdownExtensionComponent } from '@siemens/element-ng/markdown';
```

Interface an extension component must implement

```
interface SiMarkdownExtensionComponent
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [node](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L20-L20>) | `InputSignal<Node>` | Node to be rendered |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L24-L24>) | `InputSignal<any>` | Options passed to the component |
| [parent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L22-L22>) | `InputSignal<Parent>` | The parent node |

### [ComponentWithOptions](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L40-L45>)

**Kind:** interface

```
import type { ComponentWithOptions } from '@siemens/element-ng/markdown';
```

A combination of a component and options passed to it during run-time

```
interface ComponentWithOptions<T>
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [component](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L42-L42>) | `Type<T>` | The component used to render the node |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L44-L44>) (optional) | `any` | Options passed to the component |

### [PluginWithOptions](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L69-L74>)

**Kind:** interface

```
import type { PluginWithOptions } from '@siemens/element-ng/markdown';
```

Combination of unified plugin with options

```
interface PluginWithOptions
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L73-L73>) (optional) | `any` | Options passed during plugin registration |
| [plugin](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L71-L71>) | `UnifiedPlugin` | The plugin |

### [SiMarkdownHighlighterComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L28-L37>)

**Kind:** interface

```
import type { SiMarkdownHighlighterComponent } from '@siemens/element-ng/markdown';
```

Interface a code highlighter component must implement

```
interface SiMarkdownHighlighterComponent
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [code](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L30-L30>) | `InputSignal<string>` | The code to be highlighted |
| [language](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L32-L32>) | `InputSignal<string>` | The language |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L36-L36>) | `InputSignal<any>` | Options passed to the component |
| [updateLanguage](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L34-L34>) | `InputSignal<(lang?: string) => void>` | Function the highlighter can call to updated the displayed language |

### [ExtendedRootContent](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L124-L124>)

**Kind:** type alias

```
import type { ExtendedRootContent } from '@siemens/element-ng/markdown';
```

```
type ExtendedRootContent = RootContent | Footnotes | Citations | DirectiveNode
```

### [Footnotes](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L119-L122>)

**Kind:** interface

```
import type { Footnotes } from '@siemens/element-ng/markdown';
```

Extra node for collecting all footnotes

```
interface Footnotes extends Parent
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [children](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L121-L121>) | `FootnoteDefinition[]` | List of children.<br><br>Inherited from [Parent](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| data (optional, inherited) | `Data` | Info from the ecosystem.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |
| position (optional, inherited) | `Position` | Position of a node in a source document.<br><br>Nodes that are generated (not in the original source document) must not have a position.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L120-L120>) | `"footnotes"` | Node type.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |

### [Citations](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L113-L116>)

**Kind:** interface

```
import type { Citations } from '@siemens/element-ng/markdown';
```

Container for one or more adjacent citation nodes.

```
interface Citations extends Node
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [children](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L115-L115>) | `Citation[]` |  |
| data (optional, inherited) | `Data` | Info from the ecosystem.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| position (optional, inherited) | `Position` | Position of a node in a source document.<br><br>Nodes that are generated (not in the original source document) must not have a position.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L114-L114>) | `"citations"` | Node type.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |

### [DirectiveNode](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L54-L60>)

**Kind:** interface

```
import type { DirectiveNode } from '@siemens/element-ng/markdown';
```

AST node created by `remark-directive`.

```
interface DirectiveNode extends Parent
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [attributes](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L59-L59>) | `Record<string, string \| undefined>` | Attributes declared on the directive. |
| children (inherited) | `RootContent[]` | List of children.<br><br>Inherited from [Parent](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| data (optional, inherited) | `Data` | Info from the ecosystem.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |
| [name](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L57-L57>) | `string` | The directive name without its leading colons. |
| position (optional, inherited) | `Position` | Position of a node in a source document.<br><br>Nodes that are generated (not in the original source document) must not have a position.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L55-L55>) | `"containerDirective" \| "leafDirective" \| "textDirective"` | Node type.<br><br>Inherited from [Node](<https://developer.mozilla.org/docs/Web/API/Node>) |

### [Citation](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L105-L110>)

**Kind:** interface

```
import type { Citation } from '@siemens/element-ng/markdown';
```

Inline node that references an item in the source citation array.

```
interface Citation extends Node
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [citationIndex](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L107-L107>) | `number` |  |
| data (optional, inherited) | `Data` | Info from the ecosystem.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| position (optional, inherited) | `Position` | Position of a node in a source document.<br><br>Nodes that are generated (not in the original source document) must not have a position.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
| [text](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L109-L109>) (optional) | `string` | Text replaced by a position-based citation. |
| [type](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/si-markdown.types.ts#L106-L106>) | `"citation"` | Node type.<br><br>Inherited from [Node](<https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdast>) |
