Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom characters at runtime #91

Open
killroy42 opened this issue Apr 8, 2024 · 2 comments
Open

Add custom characters at runtime #91

killroy42 opened this issue Apr 8, 2024 · 2 comments

Comments

@killroy42
Copy link

Hi, I am using Twemoji to help with supporting characters in user-created puzzles in my puzzle site SudokuPad. But users can be very creative in adding characters, and make frequent use of unicode arrows not currently supported in Twemoji, which often don't work in mobile browsers. Is there a way for me to provide additional characters myself in the config somehow when starting the Twemojji parser?

@jdecked
Copy link
Owner

jdecked commented May 27, 2024

Currently, this isn't supported. Supporting this would be complicated and open up potential attack vectors: for example, we recognize emoji off of a giant regex, so providing additional characters would mean sanitizing and parsing a user-supplied regex.

I'll leave this issue open for discussion in case others also want this feature, but for now we won't be adding support for this.

@killroy42
Copy link
Author

killroy42 commented May 27, 2024

Currently my workaround revolves around sanitizing all arrows to the most basic form that seems to be widely supported, but sadly often is quite ugly (with blue squares as background):

C.UnicodeSubstitutions = {
	'🠀🠄🠈🠐🠔🠘🠜🠠🠤🠨🠬🠰🠴🠸🠼🡀🡄🡐🡠🡨🡰🡸🢀🢢🢦🢪🢠🢤🢨🢐🢔🢘': '←',
	'🠂🠆🠊🠒🠖🠚🠞🠢🠦🠪🠮🠲🠶🠺🠾🡂🡆🡒🡢🡪🡲🡺🢂🢣🢧🢫🢡🢥🢩🢒🢖🢚': '→',
	'🠁🠅🠉🠑🠕🠙🠝🠡🠥🠩🠭🠱🠵🠹🠽🡁🡅🡑🡡🡩🡱🡹🢁🢑🢕🢙': '↑',
	'🠃🠇🠋🠓🠗🠛🠟🠣🠧🠫🠯🠳🠷🠻🠿🡃🡇🡓🡣🡫🡳🡻🢃🢓🢗🢛': '↓',
	'🡖🡦🡮🡶🡾🢆': '↘',
	'🡗🡧🡯🡷🡿🢇': '↙',
	'🡔🡤🡬🡴🡼🢄': '↖',
	'🡕🡥🡭🡵🡽🢅': '↗',
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants