Magpie HTML - v0.1.3
    Preparing search index...

    Function parseHTML

    • Parse HTML string into a DOM document.

      Parameters

      • html: string

        HTML string to parse

      • OptionalbaseUrl: string

        Optional base URL for resolving relative URLs

      Returns Document

      Parsed DOM document

      Parses HTML using linkedom, providing a standards-compliant DOM implementation. This should be called once per document, with the result passed to all metadata extractors for performance.

      Never throws - returns a document even for malformed HTML.

      const doc = parseHTML('<html><head><title>Test</title></head></html>');
      const title = doc.querySelector('title')?.textContent;