posthtml / posthtml-toc

📑Table of contents
MIT License
4 stars 3 forks source link

Add options.ignoreMissingSelector #8

Closed spl closed 4 years ago

spl commented 4 years ago

Add the option errorIfSelectorNotFound, which, if false, prevents an error from being thrown if the selector is not found.

Fixes #6

spl commented 4 years ago

I'm open to feedback, including on the name of the option and if this is the best approach.

voischev commented 4 years ago

mb revert skipParseError|skipProcessError ?

spl commented 4 years ago

mb revert skipParseError|skipProcessError ?

Hmm. It's not exactly a parsing error, and I don't think of it as a processing error personally. I guess I view it as how you interpret the HTML input with or without the selector: is it a failure or not?

spl commented 4 years ago

Another option for the name is ignoreMissingSelector.

voischev commented 4 years ago

ignoreMissingSelector 👍

spl commented 4 years ago

Done. Thanks!