GithubHelp home page GithubHelp logo

isabella232 / highlightjs-mde-languages Goto Github PK

View Code? Open in Web Editor NEW

This project forked from highlightjs/highlightjs-mde-languages

0.0 0.0 0.0 140 KB

MDE language grammars for Highlight.js

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

highlightjs-mde-languages's Introduction

Highlight.js Grammars for MDE languages

Provided grammars

  • ATL - Atlanmod Transformation Language

  • OCL - Object Constraint Language

  • Xcore - Extended concrete syntax for Ecore

Download

The minified and browserified pakage is available here.

Usage

Web page or Node.js

Include the Highlight.js library in your webpage or Node app, then load this module.

<script type="text/javascript" src="/path/to/highlight.min.js"></script>
<script type="text/javascript" charset="UTF-8"
  src="/path/to/highlightjs-mde-languages/dist/mde-languages.min.js"></script>
<script type="text/javascript">
  hljs.highlightAll();
</script>

Reveal.js

First, set the revealjs_plugins attribute in the beginning of your Asciidoc document:

:revealjs_plugins: revealjs-plugins.js

Second, create the revealjs-plugins.js file, next to your Asciidoc document (you can specify a different path, of you want):

{src: 'mde-languages.min.js', async:true, callback: function() { hljs.initHighlightingOnLoad(); }}

Asciidoctor Reveal.js will add this line to the generated Reveal.js configuration, allowing it to load the highlighjs-mde grammars.

Finally, compile your code and take a look at the generated html file. In the bottom, you should find the following lines:

  // Optional libraries used to extend on reveal.js
  dependencies: [
      { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
      { src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
      { src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
      { src: 'reveal.js/plugin/notes/notes.js', async: true },
      {src: 'mde-languages.min.js', async:true, callback: function() { hljs.initHighlightingOnLoad(); }}
  ],

As you see, Asciidoctor Reveal.js just adds the contents of the revealjs-plugins.js to Reveal.js list of dependencies.

Examples

I use these grammars in the slides of my Model-driven Engineering course:

Local build

  1. Use npm to install dependencies: npm install

  2. Run the build script: npm run build

  3. The packaged file (mde-languages.min.js) is placed in the build folder.

highlightjs-mde-languages's People

Contributors

dependabot[bot] avatar joshgoebel avatar sunye avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.