-
Notifications
You must be signed in to change notification settings - Fork 3
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
start rewrite #8
Open
capital-G
wants to merge
9
commits into
highlightjs:master
Choose a base branch
from
capital-G:rewrite
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6fa24a5
start rewrite
capital-G bc54363
fix package.json
capital-G 1687a63
add name to return object
capital-G f289a7e
remove travis
capital-G d15b877
add makefile
capital-G c15d9fe
update docs
capital-G a7dd4cd
add github workflow
capital-G b2e2da7
fix make typo
capital-G 7383acc
checkout in ci
capital-G File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: ci | ||
|
||
permissions: | ||
pull-requests: write | ||
issues: write | ||
repository-projects: write | ||
contents: write | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main, rewrite] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: make test-docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM node:alpine | ||
|
||
WORKDIR /highlightjs/ | ||
|
||
RUN apk add git | ||
|
||
RUN git clone --depth 1 --branch 11.7.0 https://github.com/highlightjs/highlight.js.git | ||
|
||
RUN cd /highlightjs/highlight.js && npm install | ||
|
||
COPY package.json /highlightjs/sclang/package.json | ||
COPY package-lock.json /highlightjs/sclang/package-lock.json | ||
|
||
RUN cd sclang && npm install | ||
|
||
ENV ONLY_EXTRA=true | ||
|
||
RUN ln -s /highlightjs/sclang /highlightjs/highlight.js/extra/sclang | ||
|
||
RUN cd /highlightjs/highlight.js node ./tools/build.js -t node | ||
|
||
WORKDIR "/highlightjs/sclang" | ||
|
||
COPY . /highlightjs/sclang | ||
|
||
CMD [ "/bin/sh", "-c", "cd /highlightjs/highlight.js && node ./tools/build.js -t cdn" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.PHONY: docker-container | ||
docker-container: | ||
docker build -t sc-highlightjs . | ||
|
||
.PHONY: dev | ||
dev: | ||
python3 -m http.server | ||
|
||
.PHONY: build-docker | ||
build-docker: docker-container | ||
mkdir -p dist | ||
docker run --volume "`pwd`/dist:/highlightjs/sclang/dist" sc-highlightjs | ||
|
||
.PHONY: test-docker | ||
test-docker: docker-container | ||
docker run sc-highlightjs npm run test | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,72 @@ | ||
# highlightjs-supercollider | ||
# supercollider - a sclang language grammar for highlightjs | ||
|
||
SuperCollider module for highlight.js | ||
![license](https://badgen.net/badge/license/MIT/blue) | ||
|
||
> sclang is the language of the audio synthesis platform SuperCollider | ||
|
||
The implementation details are lent from <https://github.com/highlightjs/highlightjs-cypher> and <https://github.com/highlightjs/highlightjs-robots-txt>. | ||
|
||
## Usage | ||
|
||
Simply include the Highlight.js library in your webpage or Node app, then load this module. | ||
|
||
### Static website or simple usage | ||
|
||
Simply load the module after loading Highlight.js. | ||
It is possible to use the minified version found in the `dist` directory. This module is just a CDN build of the language, so it will register itself as the Javascript is loaded. | ||
|
||
```html | ||
<script type="text/javascript" src="/path/to/highlight.min.js"></script> | ||
<script type="text/javascript" src="/path/to/sclang.min.js"></script> | ||
<script type="text/javascript"> | ||
hljs.highlightAll(); | ||
</script> | ||
``` | ||
|
||
### Using directly from the UNPKG CDN | ||
|
||
TODO | ||
|
||
### With Node or another build system | ||
|
||
If you're using Node / Webpack / Rollup / Browserify, etc, simply require the language module, then register it with Highlight.js. | ||
|
||
```javascript | ||
var hljs = require('highlight.js'); | ||
var hljsSclang = require('highlightjs-sclang'); | ||
|
||
hljs.registerLanguage("sclang", hljsSclang); | ||
hljs.highlightAll(); | ||
``` | ||
|
||
## Development | ||
|
||
Start a local development server via `python3 -m http.server` and access the `test.html` file on <http://127.0.0.1:8000/test/test.html>. | ||
After this modify the `src/sclang.js` file and reload the browser. | ||
|
||
After the adjustments have been made, it is necessary to build a minified version before it can be published. | ||
|
||
### How to build | ||
|
||
As the build process is rather complex (see <https://github.com/highlightjs/highlight.js/blob/main/extra/3RD_PARTY_QUICK_START.md>) this repository relies on Docker to create deterministic builds on any platform. | ||
|
||
```shell | ||
docker build -t sc-highlightjs . | ||
# mount the artifacts dist folder from container to host | ||
docker run --volume "$(pwd)/dist:/highlightjs/sclang/dist" sc-highlightjs | ||
``` | ||
|
||
Alternatively use `make build-docker`. | ||
|
||
### How to run tests | ||
|
||
```shell | ||
docker build -t sc-highlightjs . | ||
docker run sc-highlightjs npm run test | ||
``` | ||
|
||
Alternatively use `make test-docker`. | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*! `sclang` grammar compiled for Highlight.js 11.7.0 */ | ||
var hljsGrammar=(()=>{"use strict";return e=>{const a=e.COMMENT("/\\*","\\*/",{ | ||
contains:[e.C_BLOCK_COMMENT_MODE]});return{ | ||
aliases:["supercollider","sc","sclang"],keywords:{ | ||
keyword:"arg classvar|10 const super this var|2", | ||
built_in:"false inf|2 nil|2 true thisFunction|10 thisFunctionDef|10 thisMethod|10 thisProcess|10 thisThread|10 currentEnvironment|10 topEnvironment|10" | ||
},contains:[{className:"type",begin:/\b(Synth|SynthDef)\b/,relevance:10},{ | ||
className:"type",begin:"\\b[A-Z]\\w*\\b",relevance:0},{className:"meta", | ||
begin:"_\\w+",relevance:0},{className:"literal",begin:"\\$\\\\?."},{ | ||
className:"title",begin:"~\\w+",relevance:2},{className:"number",variants:[{ | ||
begin:"\\b\\d+r[0-9a-zA-Z]*(\\.[0-9A-Z]*)?\\b"},{begin:/\b\d+(s+|b+|[sb]\d+)\b/ | ||
},{begin:"\\b((\\d+(\\.\\d+)?([eE][-+]?\\d+)?(pi)?)|pi)\\b"},{ | ||
begin:"\\b0x[a-fA-F0-9]+\\b"}],relevance:0},{className:"string",variants:[{ | ||
begin:"\\\\\\w+",relevance:5},e.APOS_STRING_MODE,{begin:"[A-Za-z_]\\w*\\:", | ||
relevance:0}]},e.QUOTE_STRING_MODE,e.C_LINE_COMMENT_MODE,a], | ||
illegal:/\bclass\s+[A-Z]/}}})();export default hljsGrammar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*! `sclang` grammar compiled for Highlight.js 11.7.0 */ | ||
(()=>{var e=(()=>{"use strict";return e=>{const n=e.COMMENT("/\\*","\\*/",{ | ||
contains:[e.C_BLOCK_COMMENT_MODE]});return{ | ||
aliases:["supercollider","sc","sclang"],keywords:{ | ||
keyword:"arg classvar|10 const super this var|2", | ||
built_in:"false inf|2 nil|2 true thisFunction|10 thisFunctionDef|10 thisMethod|10 thisProcess|10 thisThread|10 currentEnvironment|10 topEnvironment|10" | ||
},contains:[{className:"type",begin:/\b(Synth|SynthDef)\b/,relevance:10},{ | ||
className:"type",begin:"\\b[A-Z]\\w*\\b",relevance:0},{className:"meta", | ||
begin:"_\\w+",relevance:0},{className:"literal",begin:"\\$\\\\?."},{ | ||
className:"title",begin:"~\\w+",relevance:2},{className:"number",variants:[{ | ||
begin:"\\b\\d+r[0-9a-zA-Z]*(\\.[0-9A-Z]*)?\\b"},{begin:/\b\d+(s+|b+|[sb]\d+)\b/ | ||
},{begin:"\\b((\\d+(\\.\\d+)?([eE][-+]?\\d+)?(pi)?)|pi)\\b"},{ | ||
begin:"\\b0x[a-fA-F0-9]+\\b"}],relevance:0},{className:"string",variants:[{ | ||
begin:"\\\\\\w+",relevance:5},e.APOS_STRING_MODE,{begin:"[A-Za-z_]\\w*\\:", | ||
relevance:0}]},e.QUOTE_STRING_MODE,e.C_LINE_COMMENT_MODE,n], | ||
illegal:/\bclass\s+[A-Z]/}}})();hljs.registerLanguage("sclang",e)})(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would all these excludes for root/AFP be necessary? Just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iuse the template from https://marketplace.visualstudio.com/items?itemName=codezombiech.gitignore and they seem to work for me just fine - of course its 90% not relevant for the project but they are good defaults