Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 6469e4b

Browse files
committed
inital commit
0 parents  commit 6469e4b

File tree

17 files changed

+895
-0
lines changed

17 files changed

+895
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## Contributing
2+
3+
[fork]: https://github.com/github/github-syntax-theme/fork
4+
[pr]: https://github.com/github/github-syntax-theme/compare
5+
[style]: http://primercss.io/guidelines/
6+
7+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
8+
9+
After you open your first pull request, you will be asked to accept [this license agreement](https://cla.github.com/). Let us know in the PR if you have any hesitation or concerns.
10+
11+
## Using the issue tracker
12+
13+
The [issue tracker](https://github.com/github/github-syntax-theme/issues) is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following restrictions:
14+
15+
* Please **do not** use the issue tracker for personal support requests.
16+
* Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
17+
18+
## Bug reports
19+
20+
A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful, so thanks!
21+
22+
Guidelines for bug reports:
23+
24+
0. **Validate and lint your code** — [validate your HTML](http://html5.validator.nu) to ensure your problem isn't caused by a simple error in your own code.
25+
26+
1. **Use the GitHub issue search** — check if the issue has already been reported.
27+
28+
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository.
29+
30+
3. **Isolate the problem** — ideally create a [reduced test case](https://css-tricks.com/reduced-test-cases/) and a live example. [This JS Bin](http://jsbin.com/lefey/1/edit?html,output) is a helpful template.
31+
32+
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? Do other browsers show the bug differently? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
33+
34+
Example:
35+
36+
> Short and descriptive example bug report title
37+
>
38+
> A summary of the issue and the browser/OS environment in which it occurs. If
39+
> suitable, include the steps required to reproduce the bug.
40+
>
41+
> 1. This is the first step
42+
> 2. This is the second step
43+
> 3. Further steps, etc.
44+
>
45+
> `<url>` - a link to the reduced test case
46+
>
47+
> Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits).
48+
49+
## Feature requests
50+
51+
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
52+
53+
## Pull requests
54+
55+
Good pull requests—patches, improvements, new features—are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
56+
57+
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
58+
59+
Adhering to the following process is the best way to get your work included in the project:
60+
61+
1. Fork and clone the repository
62+
2. Configure and install the dependencies: `bower install`
63+
3. Create a new branch: `git checkout -b my-branch-name`
64+
4. Make your change, add tests, and make sure the tests still pass
65+
5. Push to your fork and [submit a pull request](https://help.github.com/articles/creating-a-pull-request/)
66+
6. Pat your self on the back and wait for your pull request to be reviewed and merged.
67+
68+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
69+
70+
- Follow the [style guide][style].
71+
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
72+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
73+
74+
## Resources
75+
76+
- [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
77+
- [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
78+
- [GitHub Help](https://help.github.com)

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
build
3+
*.log
4+
.DS_Store

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: node_js
2+
node_js:
3+
- '5'
4+
5+
deploy:
6+
provider: npm
7+
email: ${NPM_EMAIL}
8+
api_key: ${NPM_API_KEY}
9+
skip_cleanup: true
10+
on:
11+
branch: master
12+
repo: ${TRAVIS_REPO_SLUG}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# HEAD
2+
3+
# 0.1.0
4+
5+
- Initial release. Support for Ace, Atom, CSS, Textmate themes.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 GitHub, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# GitHub syntax theme generators
2+
3+
[![NPM version](https://img.shields.io/npm/v/github-syntax-theme-generator.svg)](https://www.npmjs.org/package/github-syntax-theme-generator)
4+
[![Build Status](https://travis-ci.org/primer/github-syntax-theme-generator.svg?branch=master)](https://travis-ci.org/primer/github-syntax-theme-generator)
5+
6+
> The GitHub syntax theme generator will generate themes for multiple platforms based on the GitHub syntax theme.
7+
8+
## Install
9+
10+
This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install `octicons` with this command.
11+
12+
```
13+
$ npm install --save octicons
14+
```
15+
16+
17+
This repository contains the syntax highlighting theme used on github.com and
18+
gist.github.com. It is made available as a CSS stylesheet,
19+
[Ace](http://ace.c9.io) stylesheet, Atom theme, and TextMate bundle.
20+
21+
## Installing
22+
23+
### CSS
24+
25+
The `.css` files can be used directly in a website.
26+
27+
### Atom
28+
29+
$ ln -s $(pwd)/atom/github-light ~/.atom/themes/github-light
30+
31+
### TextMate
32+
33+
Double-click the `.tmbundle` file.
34+
35+
## Development
36+
37+
$ script/bootstrap
38+
$ script/generate
39+
40+
`script/generate` takes the theme definition in the JSON file and converts it
41+
to the various output formats. Don't modify the generated files directly;
42+
instead, modify the JSON file and run `script/generate` again.

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const theme = require("./lib/theme")
2+
const adapters = require("./lib/adapters")
3+
const _ = require("lodash")
4+
5+
_.map({
6+
"light": "GitHub Light",
7+
"dark": "GitHub Dark"
8+
}, (name, variation) => {
9+
Object.keys(adapters).map( k => {
10+
const adapter = adapters[k]
11+
adapter.call(this, theme, variation, name)
12+
})
13+
})

lib/adapters/ace.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const exec = require("child_process").exec
2+
const mkdirp = require("mkdirp")
3+
const fs = require("fs")
4+
5+
module.exports = (theme, variation, name) => {
6+
mkdirp.sync("build/ace")
7+
fs.unlink("build/ace/github-" + variation + ".css")
8+
exec("node node_modules/ace/tool/tmtheme.js github-" + variation + " \"build/tmtheme/" + name + ".tmbundle/Themes/" + name + ".tmTheme\" build/ace", (error, stdout, stderr) => {
9+
if (error) {
10+
throw error;
11+
}
12+
var css = fs.readFileSync("build/ace/github-" + variation + ".css")
13+
var reg = new RegExp("\\.ace\-github\-" + variation + " ?\\.", "gi")
14+
css = css.toString().replace(reg, ".")
15+
fs.writeFileSync("build/ace/github-" + variation + ".css", css)
16+
fs.unlink("build/ace/github-" + variation + ".js")
17+
});
18+
}

lib/adapters/atom.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const exec = require("child_process").exec
2+
const mkdirp = require("mkdirp")
3+
4+
module.exports = (theme, variation, name) => {
5+
mkdirp.sync("build/atom")
6+
exec("apm init --theme build/atom/github-" + variation + " --convert \"build/tmtheme/" + name + ".tmbundle/Themes/" + name + ".tmTheme\"", (error, stdout, stderr) => {
7+
if (error) {
8+
throw error;
9+
}
10+
})
11+
}

0 commit comments

Comments
 (0)