highlightjs_fenl v0.1.0
Fenl syntax highlighting for highlight.js
Fenl is the query language for Kaskada specialized for processing timestamped event data. This repository contains the Fenl syntax highlighting for highlight.js.
Usage
Static web pages
Simply load this module after loading Highlight.js. See below on how to generate the minified version for fenl.
<script type="text/javascript" src="/path/to/highlight.min.js"></script>
<script type="text/javascript" src="/path/to/fenl.min.js"></script>
<!-- Use any stylesheet you'd like - though it's best to choose from
those in highlightjs core repo -->
<link rel="stylesheet" href="https://unpkg.com/highlightjs/styles/vs.css" />
<script type="text/javascript">
hljs.highlightAll();
</script>This will find and highlight code inside <pre><code> tags; it does not to detect the language automatically so please specify fenl for the language.
<pre>
<code class="language-fenl">
# How many big purchases happen each hour and where?
# Anything can be named and re-used
let hourly_big_purchases = Purchase
| when(Purchase.amount > 10)
# Filter anywhere
| count(window=since(hourly()))
# Aggregate anything
| when(hourly())
# Shift timelines relative to each other
let purchases_now = count(Purchase)
let purchases_yesterday =
purchases_now | shift_by(days(1))
# Records are just another type
in { hourly_big_purchases, purchases_in_last_day: purchases_now - purchases_yesterday }
</code>
</pre>For more details on usage, see highlight.js usage.
Using directly from jsDelivr
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js"></script>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/highlightjs_fenl/dist/fenl.min.js"></script>- More info: https://www.jsdelivr.com/
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.
var hljs = require('highlightjs');
var hljsFenl = require('highlightjs_fenl');
hljs.registerLanguage('fenl', hljsFenl);
hljs.highlightAll();Development Setup
For the full details please read the highlightjs documentation,
language contributor checklist: https://highlightjs.readthedocs.io/en/latest/language-contribution.html
- third-party quickstart: https://github.com/highlightjs/highlight.js/blob/master/extra/3RD_PARTY_QUICK_START.md
general information on building and testing: https://highlightjs.readthedocs.io/en/latest/building-testing.html
Quickstart
- Make sure
nodeandnpmare available to you. Clone the main highlight.js repository:
git clone https://github.com/highlightjs/highlight.js.gitInstall dependencies
$ cd .../highlight.js $ npm installClone this repo (or create a fork) into the
extradirectory:$ cd extra $ git clone https://github.com/USERNAME/highlightjs-chapelMake sure things work as expected:
npm run build_and_testSpecifically, at the end of this test run, you should see output for each of the tests in
test/markup/chapel/, e.g.
fenl
✔ have a name
✔ have 27 regex matchers
✔ should not use octal escapes
✔ should not cause exponential backtracking
✔ should not cause polynomial backtrackingNOTE: fenl currently does not support autodetection, one test will fail but you can ignore it for now. 1. Run
npm run build-cdn- Copy
build/languages/fenl.min.jsto this repo'sdistfolder and commit the changes.
Build minified version
Run
npm run build-cdnOnce the build is complete you can find the minified version in build/languages/fenl.min.js
2 years ago