interface BBCodeProcessingRule {
    id: string;
    tags?: string[];
    toData?: ((element, content) => undefined | string);
    toView?: undefined;
}

Implemented by

Properties

Properties

id: string

Some ID solely used for debugging purpose. Recommended to keep unique among rules, though.

tags?: string[]

BBCode tags, this rule is related to. Automatically also registers tags as known to BBCode to HTML processing.

Typically, you list tags here, which are generated during toData mapping.

toData?: ((element, content) => undefined | string)

Transforms an element or parts of it to BBCode. Typical rules will apply mapping according to the element type, name or one of its attributes.

It is recommended to clean any consumed attribute values, to signal that they got processed.

Type declaration

    • (element, content): undefined | string
    • Parameters

      • element: HTMLElement

        element to transform

      • content: string

        the current BBCode

      Returns undefined | string

Returns

the new BBCode to continue with; undefined to continue with BBCode as is.

toView?: undefined

toView mapping, thus, BBCode to HTML relies on third-party tooling. No extension point available.