Skip to content

Syntax highlighting for relative code files (Not Embedded ones) #23810

Answered by lee-dohm
ghost asked this question in General
Discussion options

You must be logged in to vote

Hello @Just-A-Visitor, thanks for joining us.

If you’re talking about displaying code via GitHub Pages, you’re correct, there isn’t any built-in syntax highlighting support for full files. The way you linked to the source code file there, you’re essentially telling the browser to download it as a raw text file. What you could do instead is link to the source code file on GitHub itself via an absolute URL or there may be an extension for Jekyll (or whatever other static website generator you might be using) that would do this syntax highlighting work for you.

I hope that helps!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants