Skip to content

Commit

Permalink
Merge branch 'master' into markup_for_all
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Nov 17, 2020
2 parents 17fc248 + 4fed71d commit 466d36a
Show file tree
Hide file tree
Showing 64 changed files with 779 additions and 271 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,132 @@
name: Release

on:
push:
tags:
- "*beta*"
- "*pre*"
# uncomment this later when we're ready for production releases
# - "1[0-9]+.[0-9]+.[0-9]+"

jobs:
prerelease:
name: Pre-release
runs-on: ubuntu-latest
steps:
- name: Checkout highlight.js
uses: actions/checkout@v2

- name: Tag is ${{ github.ref }}.
# we have to repeat ourselves here since the environment is not actually updated
# until the next step executes, so we can't access $TAG_NAME yet
run: |
echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo "MAJOR_VERSION=$(echo ${GITHUB_REF/refs\/tags\//} | cut -d'.' -f1)" >> $GITHUB_ENV
- name: Make sure we are pushing a tag...
if: ${{ !contains(github.ref,'refs/tags/') }}
run: false
# run: echo "TAG_NAME=0.0.0-test0" >> $GITHUB_ENV

- if: contains(github.ref, 'beta') || contains(github.ref, 'pre')
run: |
echo "NPM_TAG=beta" >> $GITHUB_ENV
echo "RELEASING=beta" >> $GITHUB_ENV
- if: ${{ !(contains(github.ref, 'beta') || contains(github.ref, 'pre')) }}
run: |
echo "NPM_TAG=latest" >> $GITHUB_ENV
echo "RELEASING=stable" >> $GITHUB_ENV
- name: match-tag-to-package-version
uses: geritol/match-tag-to-package-version@0.0.2
env:
TAG_PREFIX: refs/tags/ # Optional, default prefix refs/tags/

- name: Use Node.js 15.x
uses: actions/setup-node@v1
with:
node-version: 15.x
- name: Build Node.js package
run: |
npm install
node ./tools/build.js -t node
npm test
- name: Publish highlight.js to NPM
id: publish
uses: JS-DevTools/npm-publish@v1
with:
check-version: true
token: ${{ secrets.NPM_TOKEN }}
package: ./build/package.json
tag: ${{ env.NPM_TAG }}

- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
# if stable release
- name: Stable Release
if: env.RELEASING == 'stable'
run: echo "BRANCH_NAME=${MAJOR_VERSION}-stable" >> $GITHUB_ENV
# else (beta)
- name: Beta Release
if: env.RELEASING == 'beta'
run: echo "BRANCH_NAME=master" >> $GITHUB_ENV
- name: Confirm release is either stable or beta
if: ${{ !(env.RELEASING == 'stable' || env.RELEASING == 'beta') }}
run: |
echo We seem to be releasing `${RELEASING}`.
false
- name: Checkout cdn-release
uses: actions/checkout@v2
with:
repository: 'highlightjs/cdn-release'
path: 'cdn-release'
token: ${{ secrets.CDN_REPO_TOKEN }}
ref: ${{ env.BRANCH_NAME }}

- name: Build CDN package
run: node ./tools/build.js -t cdn :common

- name: Commmit & Push cdn-release ${{ env.TAG_NAME }}
working-directory: ./cdn-release
run: |
rm -r ./build
mv ../build/ ./build/
git config user.name github-actions
git config user.email github-actions@github.com
git add ./build/
git commit -m'Update to version ${{ env.TAG_NAME }}'
git tag ${TAG_NAME}
git push -f --atomic origin ${BRANCH_NAME} ${TAG_NAME}
- name: Publish cdn-assets to NPM
id: publish_cdn
uses: JS-DevTools/npm-publish@v1
with:
check-version: true
token: ${{ secrets.NPM_TOKEN }}
package: ./cdn-release/build/package.json
tag: ${{ env.NPM_TAG }}

# log.info('Updating CDN repo at %s' % settings.HLJS_CDN_SOURCE)
# run(['nodejs', 'tools/build.js', '--target', 'cdn', ':common'])
# os.chdir(settings.HLJS_CDN_SOURCE)
# run(['git', 'pull', '-f'])
# lines = run(['git', '--git-dir', os.path.join(settings.HLJS_CDN_SOURCE, '.git'), 'tag'])
# build_dir = os.path.join(settings.HLJS_CDN_SOURCE, 'build')
# if version in lines:
# log.info('Tag %s already exists in the local CDN repo' % version)
# else:
# if os.path.exists(build_dir):
# shutil.rmtree(build_dir)
# shutil.move(os.path.join(settings.HLJS_SOURCE, 'build'), build_dir)
# run(['git', 'add', '.'])
# run(['git', 'commit', '-m', 'Update to version %s' % version])
# run(['git', 'tag', version])
# run(['git', 'push'])
# run(['git', 'push', '--tags'])
# npm_publish(build_dir)
# os.chdir(settings.HLJS_SOURCE)
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,3 +15,4 @@ extra/

# misc
/work
/website
1 change: 1 addition & 0 deletions AUTHORS.txt
Expand Up @@ -309,3 +309,4 @@ Contributors:
- Patrick Scheibe <patrick@halirutan.de>
- Kyle Brown <kylebrown9@github>
- Marcus Ortiz <mportiz08@gmail.com>
- Guillaume Grossetie <ggrossetie@yuzutech.fr>
21 changes: 20 additions & 1 deletion CHANGES.md
@@ -1,4 +1,8 @@
## Version 10.4.0 (work in process)
## Version 10.4.0-beta1

Parser:

- enh(parser) use negative look-ahead for `beginKeywords` support (#2813) [Josh Goebel][]

Deprecations:

Expand All @@ -14,10 +18,21 @@ Parser:
New Languages:

- Added 3rd party Chapel grammar to SUPPORTED_LANGUAGES (#2806) [Brad Chamberlain][]
- Added BBCode grammar to SUPPORTED_LANGUAGES (#2867) [Paul Reid][]
- enh(javascript) Added `node-repl` for Node.js REPL sessions (#2792) [Marat Nagayev][]

Language Improvements:

- enh(shell) Recognize prompts which contain tilde `~` (#2859) [Guillaume Grossetie][]
- enh(shell) Add support for multiline commands with line continuation `\` (#2861) [Guillaume Grossetie][]
- enh(autodetect) Over 30+ improvements to auto-detect (#2745) [Josh Goebel][]
- 4-5% improvement in auto-detect against large sample set
- properties, angelscript, lsl, javascript, n1ql, ocaml, ruby
- protobuf, hy, scheme, crystal, yaml, r, vbscript, groovy
- python, java, php, lisp, matlab, clojure, csharp, css
- fix(r) fixed keywords not properly spaced (#2852) [Josh Goebel][]
- fix(javascript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
- fix(livescript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
- bug(xml) XML grammar was far too imprecise/fuzzy [Josh Goebel][]
- enh(xml) Improve precision to prevent false auto-detect positives [Josh Goebel][]
- fix(js/ts) Prevent for/while/if/switch from falsly matching as functions (#2803) [Josh Goebel][]
Expand All @@ -30,6 +45,7 @@ Language Improvements:
- enh(php) highlight variables (#2785) [Taufik Nurrohman][]
- fix(python) Handle comments on decorators (#2804) [Jonathan Sharpe][]
- enh(diff) improve highlighting of diff for git patches [Florian Bezdeka][]
- fix(llvm) lots of small improvements and fixes (#2830) [Josh Goebel][]
- enh(mathematica) Rework entire implementation [Patrick Scheibe][]
- Correct matching of the many variations of Mathematica's numbers
- Matching of named-characters aka special symbols like `\[Gamma]`
Expand All @@ -53,6 +69,8 @@ New themes:
- *StackOverflow Dark* by [Jan Pilzer][]
- *StackOverflow Light* by [Jan Pilzer][]

[Guillaume Grossetie]: https://github.com/mogztter
[Brad Chamberlain]: https://github.com/bradcray
[Marat Nagayev]: https://github.com/nagayev
[Fredrik Ekre]: https://github.com/fredrikekre
[Richard Gibson]: https://github.com/gibson042
Expand All @@ -64,6 +82,7 @@ New themes:
[Patrick Scheibe]: https://github.com/halirutan
[Kyle Brown]: https://github.com/kylebrown9
[Marcus Ortiz]: https://github.com/mportiz08
[Paul Reid]: https://github.com/RedGuy12


## Version 10.3.1
Expand Down
1 change: 1 addition & 0 deletions README.md
@@ -1,6 +1,7 @@
# Highlight.js

[![latest version](https://badgen.net/npm/v/highlight.js?label=latest)](https://www.npmjs.com/package/highlight.js)
[![beta](https://badgen.net/npm/v/highlight.js/beta)](https://www.npmjs.com/package/highlight.js)
[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/master/LICENSE)
[![install size](https://badgen.net/packagephobia/install/highlight.js?label=npm+install)](https://packagephobia.now.sh/result?p=highlight.js)
![minified](https://img.shields.io/github/size/highlightjs/cdn-release/build/highlight.min.js?label=minified)
Expand Down
1 change: 1 addition & 0 deletions SUPPORTED_LANGUAGES.md
Expand Up @@ -29,6 +29,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
| Awk | awk, mawk, nawk, gawk | |
| Bash | bash, sh, zsh | |
| Basic | basic | |
| BBCode | bbcode | [highlightjs-bbcode](https://github.com/RedGuy7/highlightjs-bbcode) |
| BNF | bnf | |
| Brainfuck | brainfuck, bf | |
| C# | csharp, cs | |
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -48,7 +48,7 @@
# built documents.

# The full version, including alpha/beta/rc tags.
release = '10.3.1'
release = '10.4.0-beta1'
# The short X.Y version.
version = ".".join(release.split(".")[:2])

Expand Down
46 changes: 36 additions & 10 deletions docs/language-contribution.rst
@@ -1,13 +1,37 @@
Language contributor checklist
==============================

1. Read ``extra/3RD_PARTY_QUICK_START.md``
------------------------------------------
1. Know that you are creating a 3rd party grammar
-------------------------------------------------

It contains rough high-level steps for creating a 3rd party language grammar for Highlight.js.
*Sadly, due to lack of maintainer time we no longer merge new languages grammars
into the core library.* Instead, the project works by encouraging 3rd party
language grammar development by willing contributors ready to help and maintain
them. We're also happy to host those 3rd party language grammars at the
``highlightjs`` GitHub organization. Or you're welcome to host yourself - we're
always happy to link to to new language grammars.

We also make it easy to build, maintain, and distribute 3rd party grammar
modules so that Highlight.js can always be easily extended with new languages.
Using a 3rd party language (for end users) is often as simple as just adding a
single line of code to their JavaScript or build system.

2. Create a language grammar definition file
We'd love to have your grammar as a 3rd party language module if you'd be
willing to maintain it over time. It's easy to develop and publish a 3rd party
language module. If you already started work in the main source tree - it's
trivial to convert your existing work into a 3rd party module. (you pretty much
just move your files into a new project folder)


2. Read extra/3RD_PARTY_QUICK_START.md
--------------------------------------

Next, read ``extra/3RD_PARTY_QUICK_START.md``. This should provide you with a
very high-level overview of the steps for creating a third-party language
grammar for Highlight.js.


3. Create a language grammar definition file
--------------------------------------------

The file defines a function accepting a reference to the library and returning a language object.
Expand All @@ -25,10 +49,12 @@ process and details differ for different build targets.
}
}

The name of the file is used as a short language identifier and should be usable as a class name in HTML and CSS.
The name of the file is used as a short language identifier and should be usable
as a class name in HTML and CSS. Typically you'll place this file in your
new grammar repository under ``my_new_grammar/src/languages/``.


3. Add language metadata
4. Add language metadata
----------------------------

At the top of the file there is a specially formatted comment with meta data processed by a build system.
Expand Down Expand Up @@ -56,7 +82,7 @@ The build system just makes sure that they will be in the final package in
The meaning of the other headers should be pretty obvious.


4. Create a code example
5. Create a code example
------------------------

The code example is used both to test language detection and for the demo page
Expand All @@ -66,7 +92,7 @@ Take inspiration from other languages in ``test/detect/`` and read
:ref:`testing instructions <basic-testing>` for more details.


5. Write a class reference if your class uses custom classes
6. Write a class reference if your class uses custom classes
------------------------------------------------------------

A class reference document should typically be placed at the root of your
Expand All @@ -79,14 +105,14 @@ are not going to support your custom classes and you should likely also
distribute your own custom theme.


6. Request a repository at the ``highlightjs`` organization
7. Request a repository at the ``highlightjs`` organization
----------------------------------------------------------

*This is optional.* Of course you are free to host your repository anywhere
you would like.


7. Create a pull request
8. Create a pull request
------------------------

Submit a PR to add your language to `SUPPORTED_LANGUAGES.md`.

0 comments on commit 466d36a

Please sign in to comment.