Skip to content

Commit

Permalink
chore: minor repo maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed Apr 5, 2024
1 parent f62a026 commit 6f650dc
Show file tree
Hide file tree
Showing 11 changed files with 341 additions and 329 deletions.
11 changes: 7 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions"]
[
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions"]
}
}
}],
],
"@babel/preset-react"
]
}
5 changes: 1 addition & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": [
"@readme/eslint-config",
"@readme/eslint-config/react"
],
"extends": ["@readme/eslint-config", "@readme/eslint-config/react"],
"root": true
}
18 changes: 9 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ For our general commit conventions please consult our organization contributing

To add a new language:

* Create a new directory in the fixtures directory for the language (for example): `__tests__/__fixtures__/js/`
* Add a `sample.js` file into `__tests__/__fixtures__/js/` containing a code snippet of the language you're targeting
* https://github.com/leachim6/hello-world/ is a helpful resource covering most every language
* Add a `index.js` file in `__tests__/__fixtures__/js/` that matches the following structure:
- Create a new directory in the fixtures directory for the language (for example): `__tests__/__fixtures__/js/`
- Add a `sample.js` file into `__tests__/__fixtures__/js/` containing a code snippet of the language you're targeting
- https://github.com/leachim6/hello-world/ is a helpful resource covering most every language
- Add a `index.js` file in `__tests__/__fixtures__/js/` that matches the following structure:

```js
module.exports = {
Expand All @@ -31,13 +31,13 @@ module.exports = {
aliases: {
// Any additional extension modes that this language might utilize or be known under (SQL
// variants for example). Consult the CodeMirror meta file for this list.
languageModeAlias: 'Language Name'
languageModeAlias: 'Language Name',
},
},
};
```

* Update `canonical.js` and add any mode aliases you've added into your test, mapping them back to the canonical version
* `yml``yaml`, `ts``typescript`, etc.
* Update `uppercase.js` for any new language names, or aliases, you've added.
* Lastly, make sure that the README is updated! 🚀
- Update `canonical.js` and add any mode aliases you've added into your test, mapping them back to the canonical version
- `yml``yaml`, `ts``typescript`, etc.
- Update `uppercase.js` for any new language names, or aliases, you've added.
- Lastly, make sure that the README is updated! 🚀
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
directory: '/'
schedule:
interval: monthly
reviewers:
Expand All @@ -13,7 +13,7 @@ updates:
prefix-development: chore(deps-dev)

- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: monthly
open-pull-requests-limit: 10
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
schedule:
- cron: '0 0 1 * *'

Expand All @@ -20,16 +20,16 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__tests__/
.github/
.husky/
coverage/
.eslint*
.prettier*
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ __tests__/__fixtures__/
__tests__/__snapshots__/
coverage/
dist/
*.html
*.scss
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020, ReadMe
Copyright (c) 2024, ReadMe

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ npm install --save @readme/syntax-highlighter
```

## Usage

### Read Only Mode

```js
const syntaxHighlighter = require('@readme/syntax-highlighter');
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js');
```

### Read Only with Line Numbers

```js
const syntaxHighlighter = require('@readme/syntax-highlighter');
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', { ...opts, highlightMode: true });
```

### Read Only with Line Numbers and Highlighted Ranges

```js
const syntaxHighlighter = require('@readme/syntax-highlighter');
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', {
Expand All @@ -41,19 +45,17 @@ const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', {
```

### Full CodeMirror

Access to a full code Mirror instance. See configuration settings in the [`react-codemirror2` library][react-codemirror#props]

```js
const syntaxHighlighter = require('@readme/syntax-highlighter');
const ele = syntaxHighlighter(
'console.log("Hello, world!");',
'js',
{ ...opts, editable: true },
{ ...editorProps }
);
const ele = syntaxHighlighter('console.log("Hello, world!");', 'js', { ...opts, editable: true }, { ...editorProps });
```

### Available Options

<!-- prettier-ignore-start -->
| Name | Type | Description |
| :--- | :--- | :--- |
| `customTheme` | String | Highlighting theme. One of `neo`, `material-palenight`, or `tomorrow-night`. (Setting this will override the `dark` mode option.)
Expand All @@ -63,9 +65,11 @@ const ele = syntaxHighlighter(
| `inline` | String | Wrap code in a `<span>` tag, instead of a `<div>`. |
| `ranges` | Array | Ranges of line numbers to apply highlighting to. Requires `highlightMode` enabled |
| `tokenizeVariables` | Boolean | Match and render [ReadMe variables](rdme-variable) in your markdown. |
<!-- prettier-ignore-end -->

## Languages Supported

<!-- prettier-ignore-start -->
| Language | Available language mode(s) |
| :--- | :--- |
| ASP.NET | `asp`, `aspx` |
Expand Down Expand Up @@ -110,7 +114,7 @@ const ele = syntaxHighlighter(
| TOML | `toml` |
| TypeScript | `ts`, `typescript` |
| YAML | `yaml`, `yml` |

<!-- prettier-ignore-end -->

[rdme-variable]: https://github.com/readmeio/api-explorer/tree/next/packages/variable
[codemirror]: https://github.com/codemirror/CodeMirror
Expand Down
Loading

0 comments on commit 6f650dc

Please sign in to comment.