PopClip JavaScript API Reference
    Preparing search index...

    Class RichString

    Represents a formatted text string. The underlying implementation uses a macOS Attributed String (NSAttributedString) object. Can be constructed from a plain string in RTF, HTML, or Markdown format.

    // create a RichString object from a html string
    const item = new RichString("<b>bold</b> and <i>italic</i>.", {format: 'html'});
    // create a RichString object from a markdown string
    const item = new RichString("# Title\n\nBody.", {format: 'markdown'});
    Index
    • Create a new RichString object from a string.

      Parameters

      • source: string

        The string to convert to a RichString object.

      • Optionaloptions: { format?: "rtf" | "html" | "markdown" }

        Options for the conversion.

        • Optionalformat?: "rtf" | "html" | "markdown"

          Format of the source string. Default is 'rtf'.

      Returns RichString

    html: string

    An HTML representation of the content.

    rtf: string

    An RTF representation of the content.