neocotic / europa

Library for converting HTML into valid Markdown
MIT License
158 stars 24 forks source link

Improve option parsing #89

Closed neocotic closed 2 years ago

neocotic commented 2 years ago

The Europa options were being passed around loosely-typed and references to the option objects were being passed to plugins so could, in theory, be easily changed by a non-TypeScript plugin.

The options are now strictly-typed and their parsing has been consolidated. A new Europa#options field has been added to get a copy of the parsed options as well as new Europa#getOption and Conversion#getOption methods which can return values for named options. The Conversion#options field has been adjusted to delegate to the Europa#options to better ensure immutability.

As an aside; this commit also changes TypeScript compilation so that comments are no longer removed. Hopefully this will make using Europa within an editor that provides documentation insights much easier. Additionally, Europa Core and Build exports have been adjusted to reflect what needs to be exported.