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 %}

Latest comments (2)

Collapse
 
ridomin profile image
Rido

I also miss the ability to embed a single filename from a gist, seems the file anchor is not supported.

The docs are not very clear neither

Collapse
 
michaeltharrington profile image
Michael Tharrington

I could totally see this being very helpful!