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

Create initial distributions for turtle, sparql and pie #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
# highlightjs-turtle
Semantic Web languages

[highlight.js](https://github.com/highlightjs/highlight.js) syntax definitions for these semantic web languages:
- SPARQL 1.1: [Query](https://www.w3.org/TR/sparql11-query/) and [Update](https://www.w3.org/TR/sparql11-update/) languages. See [BNF grammar](https://www.w3.org/TR/sparql11-query/#sparqlGrammar) and [syntax diagrams](http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql11-grammar.xhtml)
![logo](https://cygri.github.io/rdf-logos/png/turtle-128.png)
![logo](https://cygri.github.io/rdf-logos/png/sparql-128.png)

[`highlight.js`](https://github.com/highlightjs/highlight.js) syntax definitions for these semantic web languages:
- [Turtle 1.1](https://www.w3.org/TR/turtle/)
- [SHACL Compact](https://w3c.github.io/shacl/shacl-compact-syntax/]. See [BNF grammar](https://github.com/VladimirAlexiev/grammar-diagrams/raw/master/shaclc-grammar.ebnf) and [syntax diagrams][http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/shaclc-grammar.xhtml].
Still in TODO
- [GraphDB Rules](http://graphdb.ontotext.com/documentation/standard/reasoning.html)

Links:
- http://highlightjs.org for more info on `highlight.js` and a live demo.
- https://github.com/highlightjs/highlightjs-shexc for another semantic language, SHEX (Shape Expressions)
- [highlight-to-reveal](https://github.com/VladimirAlexiev/highlight-to-reveal) for info about using this in [reveal.js](https://github.com/hakimel/reveal.js), a tool for web-based presentations.
NOTE: this is outdated!
- SPARQL 1.1: [Query](https://www.w3.org/TR/sparql11-query/) and [Update](https://www.w3.org/TR/sparql11-update/) languages _(see [BNF grammar](https://www.w3.org/TR/sparql11-query/#sparqlGrammar) and [syntax diagrams](http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql11-grammar.xhtml))_
- [GraphDB Rules](http://graphdb.ontotext.com/documentation/standard/reasoning.html) (PIE)
- [SHACL Compact](https://w3c.github.io/shacl/shacl-compact-syntax/) _(see [BNF grammar](https://github.com/VladimirAlexiev/grammar-diagrams/raw/master/shaclc-grammar.ebnf) and [syntax diagrams](http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/shaclc-grammar.xhtml))_ _(still in TODO)_

## 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. You'll 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/pie.min.js"></script>
<script type="text/javascript" src="/path/to/turtle.min.js"></script>
<script type="text/javascript" src="/path/to/sparql.min.js"></script>
<script type="text/javascript">
hljs.highlightAll();
</script>
```

### 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');
const { pieGrammar, sparqlGrammar, turtleGrammar } = require("highlightjs-turtle");

hljs.registerLanguage('pie', pieGrammar);
hljs.registerLanguage('sparql', sparqlGrammar);
hljs.registerLanguage('turtle', turtleGrammar);
```


## Links
- http://highlightjs.org for more info on `highlight.js` and a live demo
- [`highlightjs-shexc`](https://github.com/highlightjs/highlightjs-shexc) for another semantic language, SHEX (Shape Expressions)
- [`highlight-to-reveal`](https://github.com/VladimirAlexiev/highlight-to-reveal) for info about using this in [`reveal.js`](https://github.com/hakimel/reveal.js), a tool for web-based presentations _(NOTE: this is outdated!)_

## Contributors
- Mark Ellis, [@ellismarkf](https://github.com/ellismarkf), Stardog Union
Expand Down
13 changes: 13 additions & 0 deletions dist/pie.es.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*! `pie` grammar compiled for Highlight.js 11.6.0 */
var hljsGrammar=(()=>{"use strict";return e=>{var s={
begin:/\b(Id|Consistency)\s*:/,end:"\n",keywords:"Id|1 Consistency|5",
contains:[{begin:e.IDENT_RE,className:"title"}]},n={begin:e.IDENT_RE,
className:"variable",relevance:0};return{aliases:["pie","rules"],contains:[{
begin:/^(Prefices|Axioms|Rules)/,end:/\s*\{/,
keywords:"Prefices|5 Axioms|5 Rules|5"},{begin:/^\s*\w+\s*:\s*\w+:\/\/\S+\s*$/,
className:"symbol"},e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:/\^\^[\w:]+/,
className:"type",relevance:1},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,{
begin:/\[(Constraint|Context|Cut)/,keywords:{
function:"Constraint|5 Context|0 Cut|5"}},{begin:/</,end:/>/,contains:[{
begin:/[\w:]+/}],className:"symbol",relevance:1},n,{begin:/---+/,
className:"keyword",relevance:0}]}}})();export default hljsGrammar;
13 changes: 13 additions & 0 deletions dist/pie.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*! `pie` grammar compiled for Highlight.js 11.6.0 */
(()=>{var e=(()=>{"use strict";return e=>{var s={begin:/\b(Id|Consistency)\s*:/,
end:"\n",keywords:"Id|1 Consistency|5",contains:[{begin:e.IDENT_RE,
className:"title"}]},n={begin:e.IDENT_RE,className:"variable",relevance:0}
;return{aliases:["pie","rules"],contains:[{begin:/^(Prefices|Axioms|Rules)/,
end:/\s*\{/,keywords:"Prefices|5 Axioms|5 Rules|5"},{
begin:/^\s*\w+\s*:\s*\w+:\/\/\S+\s*$/,className:"symbol"
},e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:/\^\^[\w:]+/,className:"type",
relevance:1},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,{
begin:/\[(Constraint|Context|Cut)/,keywords:{
function:"Constraint|5 Context|0 Cut|5"}},{begin:/</,end:/>/,contains:[{
begin:/[\w:]+/}],className:"symbol",relevance:1},n,{begin:/---+/,
className:"keyword",relevance:0}]}}})();hljs.registerLanguage("pie",e)})();
31 changes: 31 additions & 0 deletions dist/sparql.es.min.js

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

31 changes: 31 additions & 0 deletions dist/sparql.min.js

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

Loading