Skip to content

Commit 296c7de

Browse files
committed
chore: pulling the syntax-highlighter package over from the explorer repo
0 parents  commit 296c7de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+8248
-0
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
coverage/
3+
__tests__/__fixtures__/**/sample.*

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": [
3+
"@readme/eslint-config",
4+
"@readme/eslint-config/react"
5+
],
6+
"root": true
7+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
coverage/

.jsinspectrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"threshold": 30,
3+
"identifiers": true,
4+
"ignore": "test",
5+
"reporter": "default",
6+
"suppress": 100
7+
}

.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
__tests__/
2+
.github/
3+
coverage/
4+
.eslint*
5+
.jsinspectrc
6+
.prettier*
7+
jest.config.js

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__tests__/__fixtures__/
2+
__tests__/__snapshots__/
3+
coverage/

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing
2+
For general contributing guidelines for this repository, consult the root [contributing guide](https://github.com/readmeio/api-explorer/blob/master/CONTRIBUTING.md).
3+
4+
## Adding support for a new language
5+
6+
To add a new language:
7+
8+
* Create a new directory in the fixtures directory for the language (for example): `__tests__/__fixtures__/js/`
9+
* Add a `sample.js` file into `__tests__/__fixtures__/js/` containing a code snippet of the language you're targeting
10+
* https://github.com/leachim6/hello-world/ is a helpful resource covering most every language
11+
* Add a `index.js` file in `__tests__/__fixtures__/js/` that matches the following structure:
12+
13+
```js
14+
module.exports = {
15+
// This is the proper name of the language you're adding.
16+
language: 'JavaScript',
17+
18+
mode: {
19+
// This is the primary language mode.
20+
primary: 'js',
21+
22+
// This is a canonical, human-friendly, reference that can be used the entire language. You can omit this if it's
23+
// the same value as `primary`.
24+
canonical: 'javascript',
25+
26+
aliases: {
27+
// Any additional extension modes that this language might utilize or be known under (SQL variantes for example).
28+
// Consult the CodeMirror meta file for this list.
29+
languageModeAlias: 'Language Name'
30+
},
31+
},
32+
};
33+
```
34+
35+
* Update `canonical.js` and add any mode aliases you've added into your test, mapping them back to the canonical version
36+
* `yml``yaml`, `ts``typescript`, etc.
37+
* Update `uppercase.js` for any new language names, or aliases, you've added.
38+
* Lastly, make sure that the README is updated! 🚀

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2020, ReadMe
2+
3+
Permission to use, copy, modify, and/or distribute this software for any purpose
4+
with or without fee is hereby granted, provided that the above copyright notice
5+
and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13+
THIS SOFTWARE.

LICENSES

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

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# @readme/syntax-highlighter
2+
3+
ReadMe's React-based syntax highlighter
4+
5+
[![Build](https://github.com/readmeio/api-explorer/workflows/CI/badge.svg)](https://github.com/readmeio/api-explorer/tree/master/packages/syntax-highlighter)
6+
7+
[![](https://d3vv6lp55qjaqc.cloudfront.net/items/1M3C3j0I0s0j3T362344/Untitled-2.png)](https://readme.io)
8+
9+
## Installation
10+
11+
```
12+
npm install --save @readme/syntax-highlighter
13+
```
14+
15+
## Usage
16+
17+
```js
18+
const syntaxHighlighter = require('@readme/syntax-highlighter');
19+
console.log(syntaxHighlighter('console.log("Hello, world!");', 'js'));
20+
```
21+
22+
## Languages Supported
23+
| Language | Available language mode(s) |
24+
| :--- | :--- |
25+
| ASP.NET | `asp`, `aspx` |
26+
| C | `c` |
27+
| C++ | `c++`, `cpp`, `cplusplus` |
28+
| C# | `cs`, `csharp` |
29+
| Clojure | `clj`, `cljc`, `cljx`, `clojure` |
30+
| CSS | `css`, `less`, `sass`, `scss`, `styl`, `stylus` |
31+
| cURL | `curl` |
32+
| D | `d` |
33+
| Dart | `dart` |
34+
| Docker | `dockerfile` |
35+
| Erlang | `erl`, `erlang` |
36+
| Go | `go` |
37+
| Groovy | `gradle`, `groovy` |
38+
| Handlebars | `handlebars`, `hbs` |
39+
| HTML/XML | `html`, `xhtml`, `xml` |
40+
| HTTP | `http` |
41+
| Java | `java` |
42+
| JavaScript | `coffeescript`, `ecmascript`, `javascript`, `js`, `node` |
43+
| JSON | `json` |
44+
| Julia | `jl`, `julia` |
45+
| Kotlin | `kotlin`, `kt` |
46+
| Liquid | `liquid` |
47+
| Markdown | `markdown` |
48+
| Objective-C | `objc`, `objectivec`, |
49+
| Objective-C++ | `objc++`, `objcpp`, `objectivecpp`, `objectivecplusplus`, |
50+
| Perl | `perl`, `pl` |
51+
| PHP | `php` |
52+
| PowerShell | `powershell`, `ps1` |
53+
| Python | `py`, `python` |
54+
| Ruby | `jruby`, `macruby`, `rake`, `rb`, `rbx`, `ruby` |
55+
| Rust | `rs`, `rust` |
56+
| Scala | `scala` |
57+
| Shell | `bash`, `sh`, `shell`, `zsh` |
58+
| SQL | `cql`, `mssql`, `mysql`, `plsql`, `postgres`, `postgresql`, `pgsql`, `sql`, `sqlite` |
59+
| Swift | `swift` |
60+
| TypeScript | `ts`, `typescript` |
61+
| YAML | `yaml`, `yml` |
62+
63+
## Credits
64+
[Dom Harrington](https://github.com/domharrington/)
65+
66+
## License
67+
68+
ISC

0 commit comments

Comments
 (0)