Skip to content

How to Klipsify an arbitrary HTML element

Yehonathan Sharvit edited this page May 12, 2019 · 1 revision

By default Klipse klipsifies the HTML elements specified in klipse_settings at page load time.

You can klipsify an arbitrary HTML element at any time, by calling the function klipse.plugin.klipsify and pass it:

  1. the element to klipsify
  2. the klipse settings
  3. the mode of the element (the language of the snippet)

For instance, in order to klipsify the HTML element with id is 'my-js-snippet' that contains javascript code, you run:

klipse.plugin.klipsify(document.getElementById('my-js-snippet'), klipse_settings, "eval-javascript")

The list of available modes can be retrieved at run time by running this code:

Object.keys(cljs.core.clj__GT_js(cljs.core.deref(klipse.common.registry.mode_options)))

The modes are defined by the files under the src/klipse/lang folder.

Clone this wiki locally