cliid / rehype-twemojify

A simple rehype plugin that converts your ordinary text emojis into fancy twemojis. Full customization available.
MIT License
3 stars 4 forks source link

Draft proposal: address several bugs; refactor to TypeScript #2

Closed rossng closed 2 years ago

rossng commented 2 years ago

Hi,

I have been adapting the rehype-twemojify code to solve some issues that I encountered while adopting it in our codebase.

There were two main business logic issues I encountered:

Because I'm most comfortable working in TypeScript+pnpm, I ended up doing some more extensive refactoring to solve various issues I found with inconsistent types in the codebase. This includes various backwards-incompatible changes.

This PR also depends on some as-yet-unmerged fixes I made to the unist-util-map types.

I appreciate that these other changes might take this PR past the point where you actually want to merge it into the existing codebase. However, I'd be happy to work with you to find a set of changes that you would want to merge. (I didn't just want to run off and fork the codebase needlessy!)

rossng commented 2 years ago

I came to the conclusion that it's very hard to fix the types of unist-util-map, so I have resorted to a couple of type casts instead.

cliid commented 2 years ago

Thanks for contributing, rossng!