mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-26 12:30:20 +00:00
5e02a2caeb
This commit adds a `parseLinks` method to a new module, `plugins/discourse/references`. `parseLinks` allows us to extract the hyperlinks from `<a>` tags in "cooked" html. I added `htmlparser2` as a dependency to parse the html. There were a lot of options to choose from; I chose htmlparser2 because it has a lot of usage, reasonable performance, and suits our needs. We use this dependency in a lightweight and local way, so we can always change it later if needed. One thing which was a bit odd: I wasn't able to import it using `import`, and needed a `require` statement instead. Test plan: Unit tests added; `yarn test` passes. This is progress towards [Discourse reference and mention detection][1]. [1]: https://discourse.sourcecred.io/t/discourse-reference-mention-detection/270