Comments (8)
Just to update this thread...
So in the past year, Pygments is no longer used as GitHub's main syntax highlighter. Although it is still in use on their help, api and Jupyter notebook pages.
GitHub has changed to using PrettyLights. A syntax highlighter which hasn't been publicly released. It is pretty much impossible to find themes for it.
GitHub created a github-syntax-theme-generator under their "Primer" organization. To use it, you will need to define a JSON file with color definitions. The resulting CSS file can be found in the github-syntax-light and github-syntax-dark repositories. The generator also creates themes for Ace, Atom and TextMate.
In addition, if you need GitHub Flavored Markdown styles, there is also a separate repository for generating that CSS from SCSS: https://github.com/primer/markdown.
from github-markdown-css.
GitHub uses pygments for syntax highlighting, which is a Python library used on their servers. Marked on the other hand is a Javascript parser, used in the browser in your case.
The easiest way would be to use the GitHub's REST API to convert your makrdown files to HTML (just don't forget to supply access token for better quota limits).
from github-markdown-css.
Is there any way to do the highlighting client-side, without any HTTP requests?
E.g. is it possible to configure https://highlightjs.org/ to generate the right class names?
from github-markdown-css.
Yes you can do highlighting in the browser. Take a look at how I do it in my markdown extension :) I'm using http://prismjs.com/
E.g. is it possible to configure https://highlightjs.org/ to generate the right class names?
I doubt so (unless you find a JS port of the Pygments highlighter). But you don't need it, because you are using Marked to compile your markdown anyway (btw I'm using it too).
from github-markdown-css.
Thanks @simov! Looks like we had the same idea. :) Maybe I'll try out your extension. (I wrote my own b/c I didn't trust the closed-source ones I'd found.)
Using a client-side JS lib for syntax highlighting (effectively ignoring the syntax highlighting CSS from this module) sounds like a reasonable strategy.
I'll leave this issue as open for @sindresorhus since it'd be nice to mention something in the documentation for this module.
from github-markdown-css.
@asadovsky you can take a look at the code of your extensions. On Linux they are located in ~/.config/google-chrome/Default/Extensions
you can search where are they located in any other OS. But yeah, same reasons here :) also I'm using my extension while editing the readme files for my repositories, so the syntax highlighting is fine (you just have to use a fenced code blocks, like in GitHub - ```js)
from github-markdown-css.
GitHub uses pygments for syntax highlighting
Actually, that hasn't been true for quite a while now. As of December 2014, GitHub has been using Atom's grammars, via Linguist, for syntax highlighting.
from github-markdown-css.
Node wrapper around the pygments
https://github.com/rvagg/node-pygmentize-bundled
from github-markdown-css.
Related Issues (20)
- permalinks
- Idea: mention `starry-night`, next to `/markdown` endpoint, for syntax highlighted code with this CSS HOT 1
- Missing list default decoration HOT 3
- Switch themes based on class HOT 9
- Tables are a bit off! HOT 1
- Underline doesn't work anymore?
- How to use light theme only with React? HOT 2
- Support for Alerts
- GitHub dark isn't coloring table text correctly
- Alerts not displaying properly (`--base-size-` vars not declared) HOT 2
- CSS being tree-shaked due to `sideEffects: false`
- Feature: Support "diff" HOT 1
- 第826行 让highlight 的主题背景色失效,有点过分了 HOT 1
- does --color-fg-default apply on text color? HOT 2
- Task List style with v5.0.0 differs from that of v4.0.0 HOT 3
- Dark mode doesn't work well with tables HOT 2
- How to display .md files? Pairs with https://cdn.jsdelivr.net/npm/marked/marked.min.js, but doesn't work well. HOT 1
- CSS for Table Seems Missing HOT 1
- TODO list marker HOT 2
- how to change theme HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-markdown-css.