Skip to content
Edit this page

SiMarkdownComponent documentation

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

Component to display markdown text

This component is built using concepts from 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.

Input Properties

Name Type Default Description
citations
SiMarkdownCitation[] | undefined

Citation metadata used to create citations.

debug
boolean false

Debug mode. When true, unknown node types will be displayed along with the node as JSON.

Implements SiMarkdownControl

markdown
string ''

The markdown text to transform and display

options
SiMarkdownOptions | undefined

Options to control rendering. Can be shared across multiple instances.

Output Properties

Name Type Description
extensionEvent
{ name: string; data: any; }

Emitted by extension components.

Implements SiMarkdownControl

Attributes and Methods

Name Type Default Description
(readonly)meta
Signal<SiMarkdownMetadata> computed<SiMarkdownMetadata>(() => ({ citations: this.citations() }))

Gives access to metadata in extension components

Implements SiMarkdownControl

Types Documentation

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

Citation metadata associated with a markdown response.

Properties

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:

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

protected markdownOptions = new SiMarkdownOptions()
  .installExtension(siMarkdownMathKaTeX())
  .installUnifiedPlugin(remarkGemoji);
<si-markdown [markdown]="markdownText()" [options]="markdownOptions" />
Constructor
Methods

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

Interface of si-markdown exposed to children.

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

Options passed to makeProcessor()

Properties

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

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

Properties

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

An extension to the si-markdown component

Properties

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

SiMarkdownRoot

Omit<Root, 'children'> & { children: ExtendedRootContent[]; references?: { footnoteDefinitions?: Map<string, FootnoteDefinition>; definitions?: Map<string, Definition>; }; }
type alias
import type { SiMarkdownRoot } from '@siemens/element-ng/markdown';

Extended root with references

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

Definition of a single source

Properties

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

Interface an extension component must implement

Properties

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

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

Properties

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

Combination of unified plugin with options

Properties

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

Interface a code highlighter component must implement

Properties

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

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

Extra node for collecting all footnotes

Properties
  • List of children.

    children : FootnoteDefinition[] Inherited from Parent

  • Info from the ecosystem.

    data ? : Data Inherited from Node

  • Position of a node in a source document.

    Nodes that are generated (not in the original source document) must not have a position.

    position ? : Position Inherited from Node

  • Node type.

    type : "footnotes" Inherited from Node

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

Container for one or more adjacent citation nodes.

Properties
  • children : Citation[]

  • Info from the ecosystem.

    data ? : Data Inherited from Node

  • Position of a node in a source document.

    Nodes that are generated (not in the original source document) must not have a position.

    position ? : Position Inherited from Node

  • Node type.

    type : "citations" Inherited from Node

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

AST node created by remark-directive.

Properties
  • Attributes declared on the directive.

    attributes : Record<string, string | undefined>

  • List of children.

    children : RootContent[] Inherited from Parent

  • Info from the ecosystem.

    data ? : Data Inherited from Node

  • The directive name without its leading colons.

    name : string

  • Position of a node in a source document.

    Nodes that are generated (not in the original source document) must not have a position.

    position ? : Position Inherited from Node

  • Node type.

    type : "containerDirective" | "leafDirective" | "textDirective" Inherited from Node

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

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

Properties
  • citationIndex : number

  • Info from the ecosystem.

    data ? : Data Inherited from Node

  • Position of a node in a source document.

    Nodes that are generated (not in the original source document) must not have a position.

    position ? : Position Inherited from Node

  • Text replaced by a position-based citation.

    text ? : string

  • Node type.

    type : "citation" Inherited from Node


Except where otherwise noted, content on this site is licensed under MIT License.