Drafts Script Reference
    Preparing search index...

    Class Tag

    Tools for querying and working with tags.

    Querying tags

    // query a list of all unique tag names
    let tags = Tag.query("")

    // get filtered list of tags matching "bl", like "blue", "black"
    let blueTags = Tag.query("bl")
    Index

    Other

    Querying

    • Perform a search for tags and return an array of tag names.

      Parameters

      • queryString: string

        Search string, as you would type in the search box in the filter list. Use empty string ("") not to filter.

      Returns string[]

    Tag

    • Rename all instances of a tag in your draft library.

      Parameters

      • oldTag: string
      • newTag: string

      Returns number

      Number of drafts affected by the reassignment.

    • Return array of recently used tags. Helpful for building prompts to select tags.

      Returns string[]