node-html-to-text icon indicating copy to clipboard operation
node-html-to-text copied to clipboard

Version 8.2.0 introduced a bug with deprecated `tags` option

Open KillyMXI opened this issue 3 years ago • 1 comments

Not asking for a change but this patch broke the typescript type definitions test. The test has no format specified:

    tags: {
        a: {
            options: {
                hideLinkHrefIfSameAsText: true,
                linkBrackets: ["[", "]"],
            },
        },

This results in Error: Following selectors have no specified format: 'a'

It previously worked with the default format getting merged but that does not happen now. Also noting that in handleDeprecatedOptions there are a number of checks for the format value that may not have been set yet. Maybe needed a second call to mergeDuplicatesPreferLast after pushing all the tags to selectors.

Originally posted by @webstech in https://github.com/html-to-text/node-html-to-text/issues/249#issuecomment-1175597507

KillyMXI avatar Jul 06 '22 07:07 KillyMXI

@webstech Thank you. I was going to keep the tags option in another version as it was deprecated relatively recently. So I'm going to address this in the next version (whatever that happens to be). The bug is currently present both in the master (v8) and in v9 branch. I should keep more tests for deprecated options.

KillyMXI avatar Jul 06 '22 07:07 KillyMXI

I had to fix the issue with tags twice. It should work as intended now in version 9. To be finally removed in version 11, most likely.

KillyMXI avatar Dec 03 '22 12:12 KillyMXI