SwiftDocOrg / CommonMark

Create, parse, and render Markdown text according to the CommonMark specification
MIT License
179 stars 10 forks source link

Simplify Hashable implementation #30

Closed Lukas-Stuehrk closed 3 years ago

Lukas-Stuehrk commented 3 years ago

With the current implementation, nodes with the same type and contents have the same hash. But then in the Equatable implementation, we check for the same cmark_node. Therefore only Node instances for the same cmark_node can be used as the key in a dictionary or set, making the Hashable implementation more complicated than it needs to be.

With this change we also use the cmark_node for the Hashable implementation.

mattt commented 3 years ago

Alright, I added a changelog entry with 78c19c0, so this will be good to merge once the latest CI run passes. Thanks again for your help with this, @Lukas-Stuehrk!