-
All the docs here seem to just be listing how much of which languages are in a repo. That's great in it's own right, but it does not seem to be what the github/markup readme implied. How can I utilize this tool to perform syntax highlighting with github/markup locally? cannot find 'syntax' or 'highlig' in the docs Please help... am I being as stupid as I feel? require 'github/markup'
require 'linguist'
page_name = file.gsub(/\.md/, '.html')
conversion = GitHub::Markup.render(file, File.read(file)) # This is to test code highlighting
```ruby
def ducktales
puts "woohoo!"
end
``\`
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can't 😁 Linguist doesn't do the syntax highlighting, it only collects the grammars which are passed to the syntax highlighting engine (that's the linguist-grammars.tar.gz file attached to each release). This highlighting engine GitHub uses is not open source and is not available for use outside GitHub but if you want local syntax highlighting you'll need to look at something else like rouge which Jekyll uses (Ruby) or chroma which Hugo uses (Go). Both are static site generators that convert markdown to HTML, potentially saving you from reinventing the wheel. There are others but that should get you going. |
Beta Was this translation helpful? Give feedback.
You can't 😁 Linguist doesn't do the syntax highlighting, it only collects the grammars which are passed to the syntax highlighting engine (that's the linguist-grammars.tar.gz file attached to each release).
This highlighting engine GitHub uses is not open source and is not available for use outside GitHub but if you want local syntax highlighting you'll need to look at something else like rouge which Jekyll uses (Ruby) or chroma which Hugo uses (Go). Both are static site generators that convert markdown to HTML, potentially saving you from reinventing the wheel.
There are others but that should get yo…