Skip to content

Commit

Permalink
Merge branch 'master' into customized-elixir
Browse files Browse the repository at this point in the history
* master: (816 commits)
  (chore) add sideEffects: false to enable tree-shaking in esbuild & others
  fix(markdown) Handle `***Hello world***` without breaking (highlightjs#3457)
  (chore) DRY up php grammar just a little
  enh(php) support CSSCase attribute naming
  refactor, security issues
  enh(php) Add support for Attributes
  fix(java) prevent false variable init on `else` (highlightjs#3455)
  (ci) min change threshold for size report (highlightjs#3401)
  (themes) Add `tokyo-night-dark` (highlightjs#3467)
  enh(llvm) Improve number support, add `char.escape` (highlightjs#3471)
  (chore) simplify brainfuck grammar
  fix(brainfuck) fix highlighting of initial ++/--
  Minor change to TypeScript types and TypeScript-specific keywords (highlightjs#3466)
  fix(angelscript) Fix highlighting of int8, int16, int32, int64 (highlightjs#3464)
  enh(php) named arguments and fix php constants (highlightjs#3459)
  themes: add new felipec theme (highlightjs#3441)
  (chore) release 10.4.0
  enh(arcade) Add missing keywords for Arcade v1.16
  chore(arcade) eslint --fix, explode keywords
  enh(php) Left and right-side of double colon (highlightjs#3422)
  ...
  • Loading branch information
brainlid committed Feb 11, 2022
2 parents 092fdd4 + 891a2ff commit 7dbe12d
Show file tree
Hide file tree
Showing 1,402 changed files with 116,360 additions and 18,505 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
@@ -0,0 +1,15 @@
.DS_Store
build
docs/_build
__pycache__
*.swp
node_modules
.project

# editors
.idea/
.vscode/
.Rproj.user

# misc
/work
120 changes: 120 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,120 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true
},
extends: [
"eslint:recommended",
"standard"
],
parserOptions: {
ecmaVersion: 2015,
sourceType: "module"
},
plugins: [
"@typescript-eslint"
],
rules: {
"no-var": "warn",
"init-declarations": ["error", "always"],
"array-callback-return": "error",
"block-scoped-var": "error",
"no-multiple-empty-lines": ["error", { max: 2 }],
// we like our semi-colons
semi: ["error", "always"],
// our codebase doesn't do this at all, so disabled for now
"space-before-function-paren": ["error", "never"],
// for now ignore diff between types of quoting
quotes: "off",
// this is the style we are already using
"operator-linebreak": ["error", "before", {
overrides: {
"=": "after"
}
}],
// sometimes we declare variables with extra spacing
indent: ["error", 2, { VariableDeclarator: 2 }],
// seems like a good idea not to use explicit undefined
"no-undefined": "error",
// ensure import specifier contains file extension
"import/extensions": ["error", "always"]
},
overrides: [
{
files: ["types/*.ts", "src/*.ts"],
parser: '@typescript-eslint/parser',
rules: {
"import/no-duplicates": "off",
"import/extensions": "off"
}
},
{
files: ["src/**/*.js"],
rules: {
// make sure there is no Node.js specific API slipping into the source files
"import/no-nodejs-modules": "error",
"import/no-commonjs": "error"
}
},
{
files: ["src/languages/*.js"],
rules: {
"no-unused-expressions": "off",
// languages are all over the map and we don't want to
// do a mass edit so turn off the most egregious rule violations
// indent: "off",
camelcase: "off",
"no-control-regex": "off",
"no-useless-escape": "off",
"comma-dangle": "off",
"array-bracket-spacing": ["error", "always"
// {
// objectsInArrays: true
// }
],
// "object-curly-spacing": "warn",
// "key-spacing": "off",
// "array-bracket-spacing": ["warn"],
"array-bracket-newline": ["warn", {
multiline: true,
minItems: 2
}],
"array-element-newline": "warn",
"object-curly-newline": [1, {
minProperties: 2
}],
"object-property-newline": [2,
{ allowAllPropertiesOnSameLine: false }
]
}
},
{
files: ["demo/**/*.js"],
globals: {
hljs: "readonly"
}
},
{
files: ["test/**/*.js"],
globals: {
should: "readonly"
},
env: {
mocha: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
files: ["tools/**/*.js"],
parserOptions: {
ecmaVersion: 2018
},
rules: {
camelcase: "off"
}
}
]
};
14 changes: 14 additions & 0 deletions .eslintrc.lang.js
@@ -0,0 +1,14 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 2015,
sourceType: "module"
},
// no rules, this file exists only to lint the grammars and check
// that no ES2018 or newer syntax has crept in by accident
rules: {}
};
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/1_incorrect-syntax-highlighting.md
@@ -0,0 +1,39 @@
---
name: Report code that we highlight wrong
about: You have a specific snippet of code that is not highlighted correctly.
title: "(language name) Short description of issue..."
labels: bug, help welcome, language
assignees: ''

---

**Describe the issue**
<!-- A clear and concise description of what the issue seems to be. -->

**Which language seems to have the issue?**
<!--
Please specify exactly *which* language grammar you are using to highlight (`python`, `javascript`, etc.) or specify if you are using auto-detection. If you are using auto-detection please first check to make sure the language you are expecting was properly detected. If Highlight.js misidentifies the type of code - then the highlighting may be entirely incorrect - and there often isn't much we can do about that - auto-detection is only best-effort and can't guess right 100% of the time.
-->

**Are you using `highlight` or `highlightAuto`?**

...

**Sample Code to Reproduce**
<!--
Please include plain text examples of the code that fails to highlight properly or can reproduce the bug you are seeing. If you attach a screenshot PLEASE also provide the actually code that we can copy/paste if necessary to help resolve the issue.
A jsfiddle can sometimes be even better. You can fork an example test case:
https://jsfiddle.net/ajoshguy/cjhvre2k/
-->


**Expected behavior**
<!--
A clear and concise description of what you expected to happen. A screenshot might help here if another highlighting library gets it right, or is Github highlights it better/properly you can use a GitHub code block.
-->

**Additional context**
<!--
Add any other context about the problem here.
-->
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,31 @@
---
name: Report some other bug
about: You are seeing other incorrect, unexpected or unexplained behavior.
title: ""
labels: bug, help welcome, parser
assignees: ''

---

**Describe the issue/behavior that seems buggy**
<!-- A clear and concise description of what the bug seems to be. -->


**Sample Code or Instructions to Reproduce**
<!--
Please include sample code or step-by-step instructions to reproduce the bug you are seeing. If you attach a screenshot PLEASE also provide any actually code shown in plaintext as well so that we can easily copy/paste if necessary to help resolve the issue.
A jsfiddle can sometimes be even better. You can fork an example test case:
https://jsfiddle.net/ajoshguy/gfzujpyt/
-->


**Expected behavior**
<!--
A clear and concise description of what you expected to happen. If a screen grab would help, attach one.
-->

**Additional context**
<!--
Add any other context about the problem here.
-->
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Join our friendly Discord community
url: https://discord.gg/M24EbU7ja9
about: If you'd like to hang out, help out, or need some help - we're here.
- name: Read our documentation
url: https://highlightjs.readthedocs.io/
about: Sometimes the answers are right there, just waiting to be discovered.
- name: Request a new language
url: https://highlightjs.readthedocs.io/en/latest/language-requests.html
about: Please read our policy on requesting new languages.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -1,8 +1,8 @@
---
name: Feature request
about: Suggest a new idea or feature...
title: "[Request] ..."
labels: enhancement
name: Request a new feature (other than a new language)
about: You'd like to suggest a potentially helpful new feature... for requesting languages look below.
title: "[Request] Short description of the new feature..."
labels: enhancement, parser
assignees: ''

---
Expand Down
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,11 @@
<!--- Provide a general summary of your changes in the Title above -->

<!-- Please link to a related issue below. -->
<!-- ie, `Resolves #1234`, etc... so GitHub can magically link it -->

### Changes
<!--- Describe your changes -->

### Checklist
- [ ] Added markup tests, or they don't apply here because...
- [ ] Updated the changelog at `CHANGES.md`
26 changes: 0 additions & 26 deletions .github/workflows/greetings.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,21 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Lint

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "*" # latest
- run: npm ci
- run: npm run lint
- run: npm run lint-languages
53 changes: 53 additions & 0 deletions .github/workflows/node.js.yml
@@ -0,0 +1,53 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
build-how: ["node", "browser", "browser -n", "cdn :common"]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: node ./tools/build.js -t ${{ matrix.build-how }}
# normal browser build
- if: contains(matrix.build-how, 'browser') || contains(matrix.build-how, 'cdn')
name: Test browser/CDN build
run: |
npm run test-browser
node test/builds/browser_build_as_commonjs.js
# CDN build should be easily importable
- if: contains(matrix.build-how, 'cdn')
name: Test that we can import CDN esm build
run: |
node test/builds/cdn_build_as_esm.mjs
- if: contains(matrix.build-how, 'node')
name: Test Node.js build
run: |
npm test
# test that our build is "use strict" safe for use with packaging
# systems importing our source thru ES6 modules (rollup, etc.)
- if: contains(matrix.build-how, 'node')
name: Test Node.js build is "use strict" safe
run: |
./node_modules/.bin/rollup -c test/builds/rollup_import_via_commonjs.js
node build/bundle.js

0 comments on commit 7dbe12d

Please sign in to comment.