ggrossetie / asciidoctor-emoji

Asciidoctor.js extension to add emoji in your document!
MIT License
7 stars 5 forks source link

Allow fully offline use with data-uri #43

Closed cbergmann closed 3 years ago

cbergmann commented 3 years ago

This is a workaround for #10. This solution gives fully offline emojis with little additional code. When using one emoji multiple times this would increase the size of the overall result compared to a "download and cache" solution.

ggrossetie commented 3 years ago

Hey @cbergmann

Thanks for your contribution! Ideally, I think we should create an Image node and let Asciidoctor converts it to HTML but this is a really good first step 👌🏻

Could you please add a test in https://github.com/Mogztter/asciidoctor-emoji/blob/master/test/test.js?

ggrossetie commented 3 years ago

@cbergmann Let me know if you need guidance for writing a test

cbergmann commented 3 years ago

@Mogztter This is my first try on the test but I could not get the convert function to act like calling the cli with ' --attribute data-uri --attribute allow-uri-read'. Do you have an Idea?

cbergmann commented 3 years ago

I think this relevant part of the documentation but it does not work.

ggrossetie commented 3 years ago

This is my first try on the test but I could not get the convert function to act like calling the cli with ' --attribute data-uri --attribute allow-uri-read'. Do you have an Idea?

@cbergmann By default, the API is running in SECURE mode where data-uri is disabled (for security reasons). I've added safe: 'safe' and now the test is passing 🎉