Closed tipyy closed 3 years ago
Another idea we thought would be great to add support for embedding github gists, that way every format could be supported. What do you think?
You're totally right @feruzm ! I'll check the package you are talking about and I'll see what I can do during the week.
I would also love to have gist integration but it seems to be more work, let's postponed that for another pull request :)
I made the switch to lolight
.
The rendering is not as great as the one from highlight.js but it works and yeah it's way more tiny.
I had to use a little hack tho. The library does not really supports string directly so my implementation hardcodes the CLS_PREFIX constant.
The good point is that we don't need the pull request on ecency-vision anymore
@tipyy great, looks good to me 👍 thank you. Is there any chance you can share screenshot of how it looks and also add simple tests for this in markdown-2-html.spec.ts
?
No problem, I added a unit test.
I used the SNAPSHOT_JSON
object to match the file style, but I prefer jest snapshots.
But I know this is not something everyone agrees with.
Here is a snapshot of how it looks right now
It does not recognized as much tokens (ruby symbols are not recognized for example) but I guess that's ok for now. And we still can make pull requests, I looked at the code and it should be pretty easy to extend.
@tipyy it is live on ecency.com now 👍
@tipyy Thank you for your contribution. This is something we discussed with team while back, code highlight is good feature to have and we want to add that into render-helper.
But highlight.js adds more than 200kb size into package bundle which means it is extra 200kb on every website that use it.
What do you think if we try
lolight
package or something that's smaller? 1.6 kb https://bundlephobia.com/result?p=lolight@1.4.0