CARVIEW |
Select Language
HTTP/2 200
date: Sat, 19 Jul 2025 16:56:15 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"02371822f1b1c8348a11c67c90506cd3"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=bqrSk4jtRVJNXhXtzjK%2BRVu7EK1%2BIjG9scuJhXbhOgXX7ngaqh%2FBF%2FkVJkmDMkNwwNwDVtbT2rfwy3xw7MxOLA%2BHyHplhLQEmvqjxeJsbnR6id1nf2lYCpF2Ft0Cdd1ZiLCfkdl7CcSE4ztyXk5AlldwZp4HviuDSk6yHhe7GctDZ0RjxQMdCzt3d1ShAjK8FV0jXmk5BAZHltgHk5kbbCeVxHdrjWZwsNf%2FlkbnUbJO6r9%2Bya0pDce%2BAssduamtptAqdQ4OAxIcpHL0C1gENA%3D%3D--wU9zcP63SsRuzZ3l--BjlR3UNiLRlx07DC1o3KGg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.66638599.1752944175; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 16:56:15 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 16:56:15 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 95E2:35CC93:4D931D:6029EE:687BCE2F
Jekyll module for github like source code highlighting · GitHub
Show Gist options
Save asaaki/1007420 to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Created
June 4, 2011 00:57
-
Star
16
(16)
You must be signed in to star a gist -
Fork
4
(4)
You must be signed in to fork a gist
-
Save asaaki/1007420 to your computer and use it in GitHub Desktop.
Jekyll module for github like source code highlighting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.highlight { background-color: #49483e } | |
.c { color: #75715e } /* Comment */ | |
.err { color: #960050; background-color: #1e0010 } /* Error */ | |
.k { color: #66d9ef } /* Keyword */ | |
.l { color: #ae81ff } /* Literal */ | |
.n { color: #f8f8f2 } /* Name */ | |
.o { color: #f92672 } /* Operator */ | |
.p { color: #f8f8f2 } /* Punctuation */ | |
.cm { color: #75715e } /* Comment.Multiline */ | |
.cp { color: #75715e } /* Comment.Preproc */ | |
.c1 { color: #75715e } /* Comment.Single */ | |
.cs { color: #75715e } /* Comment.Special */ | |
.ge { font-style: italic } /* Generic.Emph */ | |
.gs { font-weight: bold } /* Generic.Strong */ | |
.kc { color: #66d9ef } /* Keyword.Constant */ | |
.kd { color: #66d9ef } /* Keyword.Declaration */ | |
.kn { color: #f92672 } /* Keyword.Namespace */ | |
.kp { color: #66d9ef } /* Keyword.Pseudo */ | |
.kr { color: #66d9ef } /* Keyword.Reserved */ | |
.kt { color: #66d9ef } /* Keyword.Type */ | |
.ld { color: #e6db74 } /* Literal.Date */ | |
.m { color: #ae81ff } /* Literal.Number */ | |
.s { color: #e6db74 } /* Literal.String */ | |
.na { color: #a6e22e } /* Name.Attribute */ | |
.nb { color: #f8f8f2 } /* Name.Builtin */ | |
.nc { color: #a6e22e } /* Name.Class */ | |
.no { color: #66d9ef } /* Name.Constant */ | |
.nd { color: #a6e22e } /* Name.Decorator */ | |
.ni { color: #f8f8f2 } /* Name.Entity */ | |
.ne { color: #a6e22e } /* Name.Exception */ | |
.nf { color: #a6e22e } /* Name.Function */ | |
.nl { color: #f8f8f2 } /* Name.Label */ | |
.nn { color: #f8f8f2 } /* Name.Namespace */ | |
.nx { color: #a6e22e } /* Name.Other */ | |
.py { color: #f8f8f2 } /* Name.Property */ | |
.nt { color: #f92672 } /* Name.Tag */ | |
.nv { color: #f8f8f2 } /* Name.Variable */ | |
.ow { color: #f92672 } /* Operator.Word */ | |
.w { color: #f8f8f2 } /* Text.Whitespace */ | |
.mf { color: #ae81ff } /* Literal.Number.Float */ | |
.mh { color: #ae81ff } /* Literal.Number.Hex */ | |
.mi { color: #ae81ff } /* Literal.Number.Integer */ | |
.mo { color: #ae81ff } /* Literal.Number.Oct */ | |
.sb { color: #e6db74 } /* Literal.String.Backtick */ | |
.sc { color: #e6db74 } /* Literal.String.Char */ | |
.sd { color: #e6db74 } /* Literal.String.Doc */ | |
.s2 { color: #e6db74 } /* Literal.String.Double */ | |
.se { color: #ae81ff } /* Literal.String.Escape */ | |
.sh { color: #e6db74 } /* Literal.String.Heredoc */ | |
.si { color: #e6db74 } /* Literal.String.Interpol */ | |
.sx { color: #e6db74 } /* Literal.String.Other */ | |
.sr { color: #e6db74 } /* Literal.String.Regex */ | |
.s1 { color: #e6db74 } /* Literal.String.Single */ | |
.ss { color: #e6db74 } /* Literal.String.Symbol */ | |
.bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ | |
.vc { color: #f8f8f2 } /* Name.Variable.Class */ | |
.vg { color: #f8f8f2 } /* Name.Variable.Global */ | |
.vi { color: #f8f8f2 } /* Name.Variable.Instance */ | |
.il { color: #ae81ff } /* Literal.Number.Integer.Long */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SCSS file! | |
// Keep in mind, that you have to modify sass code! | |
.data { | |
@include zeros; | |
border: 1px solid #100804; | |
@include border-rad(10); | |
margin-bottom: 1em; | |
width: 99%; | |
background: darken(#261e16, 5%); | |
font-size: 80%; | |
color: #f70; | |
font-family: 'Bitstream Vera Sans Mono','Courier',monospace; | |
font-size: 14px; | |
overflow: auto; | |
} | |
.data pre { | |
@include zeros; | |
} | |
.data .highlight { padding: .5em 0; } | |
.data .highlight div { padding-left: 1em; white-space: nowrap; } | |
.data .highlight div:hover { background: #16261e; } | |
.data .line_numbers { | |
background: darken(#261e16, 7.5%); | |
padding: .5em .5em .5em 1em; | |
border-right: 1px solid #132; | |
text-align: right; | |
} | |
.data .line_numbers span { | |
color: #cba; | |
cursor: default; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class SourceCoder < Liquid::Block | |
include Liquid::StandardFilters | |
# We need a language, but the linenos argument is optional. | |
SYNTAX = /(\w+)\s?([\w\s=]+)*/ | |
def initialize(tag_name, markup, tokens) | |
super | |
if markup =~ SYNTAX | |
@lang = $1 | |
else | |
raise SyntaxError.new("Syntax Error in 'sourcecode' - Valid syntax: sourcecode <lang>") | |
end | |
end | |
def render(context) | |
if context.registers[:site].pygments | |
render_pygments(context, super.join) | |
else | |
render_codehighlighter(context, super.join) | |
end | |
end | |
def render_pygments(context, code_string) | |
liners,source = "","" | |
code_array = code_string.strip.split("\n") | |
total_lines = code_array.size | |
total_lines.times do |ln| | |
liners += "<span id=\"L#{ln+1}\" rel=\"#L#{ln+1}\">#{ln+1}</span>\n" | |
end | |
code_array.each_with_index do |line,i| | |
code_line = Albino.new(line, @lang).to_s | |
code_line.gsub!(/<div class="highlight"><pre>|\n<\/pre>|\n<\/div>/,'') | |
code_line.gsub!(/^([ ])+/){|m| " "*m.size} | |
code_line = "<br/>" if code_line.strip=='' | |
source += "<div class='line' id='LC#{i+1}'>#{code_line}</div>" | |
end | |
liners_block = <<-LINERS | |
<td><pre class='line_numbers'>#{liners}</pre></td> | |
LINERS | |
source_block = <<-SOURCE | |
<td width="100%"> | |
<div class='highlight'><pre>#{source}</pre></div> | |
</td> | |
SOURCE | |
output = <<-OUTPUT | |
<div class='data type-#{@lang}'> | |
<table cellpadding='0' cellspacing='0'> | |
<tr> | |
#{liners_block} | |
#{source_block} | |
</tr> | |
</table> | |
</div> | |
OUTPUT | |
end | |
def render_codehighlighter(context, code) | |
#The div is required because RDiscount blows ass | |
<<-HTML | |
<!-- basic code highlighter / no pygments --> | |
<div class="code"> | |
<pre> | |
<code class='#{@lang}'>#{h(code).strip}</code> | |
</pre> | |
</div> | |
HTML | |
end | |
end | |
end | |
Liquid::Template.register_tag('sourcecode', Jekyll::SourceCoder) |
Hi!, i have an error "Liquid Exception: undefined method `pygments' for #Jekyll::Site:0x00000001966eb8", Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.
The Liquid tag is: