UNPKG

@adguard/agtree

Version:
30 lines (29 loc) 1.2 kB
/** * @file Metadata comments */ import { type MetadataCommentRule } from '../../nodes/index.js'; import { BaseParser } from '../base-parser.js'; /** * `MetadataParser` is responsible for parsing metadata comments. * Metadata comments are special comments that specify some properties of the list. * * @example * For example, in the case of * ```adblock * ! Title: My List * ``` * the name of the header is `Title`, and the value is `My List`, which means that * the list title is `My List`, and it can be used in the adblocker UI. * @see {@link https://help.eyeo.com/adblockplus/how-to-write-filters#special-comments} */ export declare class MetadataCommentParser extends BaseParser { /** * Parses a raw rule as a metadata comment. * * @param raw Raw input to parse. * @param options Global parser options. * @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset. * @returns Metadata comment AST or null (if the raw rule cannot be parsed as a metadata comment) */ static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): MetadataCommentRule | null; }