Forem Creators and Builders

Tushar Sadhwani
Tushar Sadhwani

Posted on

Add a way to embed github gists with highlighted lines

Github lets you highlight parts of your gist by the following syntax:

gist.github.com/username/123456#file-filename-L7, to highlight line 7 for example.

Real example: https://gist.github.com/Untrusted-Game/2a36648c4c673a3927511184246b7a17#file-untrusted-lvl5-solution-js-L14-L16

image

Trying to embed a file with lines highlighted doesn't seem to work with forem, both with and without the file=filename syntax.

It would be nice if a lines=... attribute could be added to the gist liquid tag, for example:

{% gist https://gist.github.com/Untrusted-Game/2a36648c4c673a3927511184246b7a17 file=untrusted-lvl5-solution-js lines=L14-L16 %}

Discussion (1)

Collapse
michaeltharrington profile image
Michael Tharrington

I could totally see this being very helpful!