Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jsdoc annotations and TypeScript type file #2517

Merged
merged 4 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ module.exports = {
"ecmaVersion": 2018,
"sourceType": "module"
},
"parser": '@typescript-eslint/parser',
"plugins": [
"@typescript-eslint"
],
"rules": {
"array-callback-return": "error",
"block-scoped-var": "error",
Expand All @@ -27,7 +31,7 @@ module.exports = {
// for now ignore diff between types of quoting
"quotes": "off",
// this is the style we are already using
"operator-linebreak": ["error","after", { "overrides": { "?": "after", ":": "after" } }],
"operator-linebreak": ["error","before", { "overrides": { "?": "after", ":": "after", "+": "after" } }],
// sometimes we declare variables with extra spacing
"indent": ["error", 2, {"VariableDeclarator":2}],
// seems like a good idea not to use explicit undefined
Expand Down
6 changes: 3 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ Applies highlighting to all ``<pre><code>...</code></pre>`` blocks on a page.
Attaches highlighting to the page load event.


``registerLanguage(name, language)``
``registerLanguage(languageName, languageDefinition)``
------------------------------------

Adds new language to the library under the specified name. Used mostly internally.

* ``name``: a string with the name of the language being registered
* ``language``: a function that returns an object which represents the
* ``languageName``: a string with the name of the language being registered
* ``languageDefinition``: a function that returns an object which represents the
language definition. The function is passed the ``hljs`` object to be able
to use common regular expressions defined within it.

Expand Down
119 changes: 119 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
"url": "git://github.com/highlightjs/highlight.js.git"
},
"main": "./lib/index.js",
"types": "./types/index.d.ts",
"scripts": {
"mocha": "mocha",

"build_and_test": "npm run build && npm run test",
"build": "node ./tools/build.js -t node",
"build-cdn": "node ./tools/build.js -t cdn",
"build-browser": "node ./tools/build.js -t browser :common",

"test": "mocha --globals document test",
"test-markup": "mocha --globals document test/markup",
"test-detect": "mocha --globals document test/detect",
Expand All @@ -38,6 +37,8 @@
"node": "*"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.32.0",
"@typescript-eslint/parser": "^2.32.0",
"clean-css": "^4.2.1",
"cli-table": "^0.3.1",
"colors": "^1.1.2",
Expand All @@ -62,7 +63,8 @@
"rollup-plugin-json": "^4.0.0",
"should": "^13.2.3",
"terser": "^4.3.9",
"tiny-worker": "^2.3.0"
"tiny-worker": "^2.3.0",
"typescript": "^4.0.0-dev.20200512"
},
"dependencies": {}
}
Loading