+
Skip to content

Delegate node walking to others #267

@sandstrom

Description

@sandstrom

To reduce the scope of this package (easier to maintain), how about this:

  • Remove the walker interface. Instead, the AST parser builds into a real DOM directly.
    • On the browser, this would be an instance of Document (that's what e.g. DOM Parser would output).
    • In node, something like JSDOM can be used.
    • So either of those two would be a dependency for this library.
  • That way, any sanitization or other DOM modification could either use an existing library, such as DOMPurify or write their own code using e.g. myDocument.querySelectorAll.
  • Rendering to an HTML string be as simple as myDocument.innerHTML, and others will likely just append that doc into the DOM directly, without ever producing an HTML string (perf win).

This change would radically lower the scope of this package (building on the shoulder of giants; existing web APIs basically), and would still preserve everything that's unique about this library, which is markdown parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载