UNPKG

alpaca

Version:

Alpaca provides the easiest and fastest way to generate interactive forms for the web and mobile devices. It runs simply as HTML5 or more elaborately using Bootstrap, jQuery Mobile or jQuery UI. Alpaca uses Handlebars to process JSON schema and provide

64 lines (52 loc) 1.57 kB
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Static Code highlighter using Ace</title> <meta name="author" content="Matthew Kastor"> <style type="text/css"> .code { width: 50%; position: relative; white-space: pre-wrap; } </style> </head> <body> <h2>Client Side Syntax Highlighting</h2> <p>Syntax highlighting using Ace language modes and themes.</p> <div class="code" ace-mode="ace/mode/css" ace-theme="ace/theme/chrome" ace-gutter="true"> .code { width: 50%; position: relative; white-space: pre-wrap; } </div> <pre class="code" ace-mode="ace/mode/javascript" ace-theme="ace/theme/twilight"> function wobble (flam) { return flam.wobbled = true; } </pre> <!-- load ace --> <script src="../src/ace.js"></script> <!-- load ace static_highlight extension --> <script src="../src/ext-static_highlight.js"></script> <script> var highlight = ace.require("ace/ext/static_highlight") var dom = ace.require("ace/lib/dom") function qsa(sel) { return Array.apply(null, document.querySelectorAll(sel)); } qsa(".code").forEach(function (codeEl) { highlight(codeEl, { mode: codeEl.getAttribute("ace-mode"), theme: codeEl.getAttribute("ace-theme"), startLineNumber: 1, showGutter: codeEl.getAttribute("ace-gutter"), trim: true }, function (highlighted) { }); }); </script> </body> </html>