+ Basic usage
+
+
+ You will need to include the prism.css and prism.js files you downloaded in your page. Example:
+
+
+ <!DOCTYPE html>
+<html>
+<head>
+ ...
+ <link href="themes/prism.css" rel="stylesheet" />
+ ></head>
+<body>
+ ...
+ <script src="prism.js"></script>
+ </body>
+</html>
+
+ Prism does its best to encourage good authoring practices. Therefore, it only works with <code> elements, since marking up code without a <code> element is semantically invalid.
+ According to the HTML5 spec, the recommended way to define a code language is a language-xxxx class, which is what Prism uses.
+ Alternatively, Prism also supports a shorter version: lang-xxxx.
+ To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors.
+ This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body> or <html> element.
+
+ If you want to opt-out of highlighting for a <code> element that is a descendant of an element with a declared code language, you can add the class language-none to it (or any non-existing language, really).
+
+ The recommended way to mark up a code block
+ (both for semantics and for Prism) is a <pre> element with a <code> element inside, like so:
+ <pre><code class="language-css">p { color: red }</code></pre>
+ If you use that pattern, the <pre> will automatically get the language-xxxx class (if it doesn’t already have it) and will be styled as a code block.
+
+ If you want to prevent any elements from being automatically highlighted, you can use the attribute data-manual on the <script> element you used for prism and use the API.
+ Example:
+ <script src="prism.js" data-manual></script>
+
+
+ Usage with Webpack, Browserify, & Other Bundlers
+
+ If you want to use Prism with a bundler, install Prism with npm:
+
+ $ npm install prismjs
+
+ You can then import into your bundle:
+
+ import Prism from 'prismjs';
+
+ To make it easy to configure your Prism instance with only the languages and plugins you need, use the babel plugin,
+ babel-plugin-prismjs. This will allow you to load
+ the minimum number of languages and plugins to satisfy your needs.
+ See that plugin's documentation for configuration details.
+
+
+
+ Usage with Node
+
+ If you want to use Prism on the server or through the command line, Prism can be used with Node.js as well.
+ This might be useful if you're trying to generate static HTML pages with highlighted code for environments that don't support browser-side JS, like AMP pages.
+
+ Example:
+ var Prism = require('prismjs');
+
+// The code snippet you want to highlight, as a string
+var code = "var data = 1;";
+
+// Returns a highlighted HTML string
+var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
+
+ Requiring prismjs will load the default languages: markup, css,
+ clike and javascript. You can load more languages with the
+ loadLanguages() utility, which will automatically handle any required dependencies.
+ Example:
+
+ var Prism = require('prismjs');
+var loadLanguages = require('prismjs/components/');
+loadLanguages(['haml']);
+
+// The code snippet you want to highlight, as a string
+var code = "= ['hi', 'there', 'reader!'].join \" \"";
+
+// Returns a highlighted HTML string
+var html = Prism.highlight(code, Prism.languages.haml, 'haml');
+
+
+ Note: Do not use loadLanguages() with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above.
+
+
+
diff --git a/test/bootstrap.xml b/test/bootstrap.xml
new file mode 100644
index 0000000..544de8d
--- /dev/null
+++ b/test/bootstrap.xml
@@ -0,0 +1,13 @@
+
+
+ topic
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
+
+
This page’s logo (SVG), highlighted with Prism:
+
+
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 170">
+ <path fill="#fff" d="M55.37 131.5H48.4v9.13h6.97c1.67 0 2.92-.4 3.78-1.22.85
+ -.8 1.28-1.92 1.28-3.33s-.43-2.54-1.28-3.35c-.86-.8-2.12-1.2-3.78-1.2m29.52
+ 6.4c.3-.53.47-1.2.47-2.04 0-1.35-.45-2.4-1.37-3.2-.92-.76-2.14-1.15-3.65
+ -1.15H72.9v8.52h7.32c2.26 0 3.82-.7 4.67-2.1M100 0L0 170h200L100 0M60.86
+ 141.03c-1.3 1.22-3.1 1.84-5.33 1.84H48.4v7.55H46v-21.2h9.53c2.24 0 4.02.63
+ 5.34 1.87 1.3 1.23 1.96 2.88 1.96 4.95 0 2.1-.66 3.75-1.97 4.98m24.5 9.4l
+ -5.1-8.14h-7.37v8.12h-2.4v-21.2h10.14c2.15 0 3.88.6 5.18 1.8 1.3 1.18 1.95
+ 2.8 1.95 4.84 0 2.64-1.1 4.44-3.3 5.4-.6.28-1.22.5-1.82.6l5.57 8.56h-2.85m
+ 13.43 0h-2.4v-21.2h2.4v21.2m23.56-1.32c-1.48 1.05-3.53 1.57-6.16 1.57-2.96 0
+ -5.23-.6-6.78-1.85-1.4-1.1-2.18-2.7-2.37-4.74h2.5c.08 1.45.78 2.56 2.1 3.33
+ 1.16.67 2.68 1 4.58 1 3.97 0 5.95-1.25 5.95-3.74 0-.86-.35-1.53-1.07-2.02-.7
+ -.5-1.6-.9-2.68-1.2-1.07-.33-2.24-.63-3.48-.9s-2.4-.65-3.5-1.08-1.97-1.02
+ -2.68-1.73c-.7-.72-1.07-1.68-1.07-2.9 0-1.73.65-3.13 1.97-4.22 1.32-1.08
+ 3.32-1.62 6-1.62 2.67 0 4.75.6 6.23 1.85 1.34 1.1 2.05 2.5 2.14 4.2h-2.46c
+ -.22-1.76-1.35-2.92-3.4-3.5-.72-.2-1.62-.3-2.7-.3s-1.98.1-2.72.35c-.74.25
+ -1.3.55-1.7.9-.42.35-.7.74-.83 1.17s-.2.88-.2 1.36c0 .5.2.93.62 1.33s.96.75
+ 1.65 1.03c.68.28 1.46.52 2.33.73.88.2 1.77.43 2.67.65.9.22 1.8.48 2.68.77.87
+ .3 1.65.65 2.33 1.1 1.53.96 2.28 2.27 2.28 3.94 0 2-.74 3.5-2.22 4.55m28.84
+ 1.32v-17.54l-7.84 10.08-7.97-10.08v17.54H133v-21.2h2.78l7.58 10.06 7.45
+ -10.05h2.8v21.2h-2.4"/>
+</svg>
+
+
+
Example:
+
var Prism = require('prismjs');
+
+
+var code = "var data = 1;";
+
+
+var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
+
+
Requiring prismjs
will load the default languages: markup
, css
,
+ clike
and javascript
. You can load more languages with the
+ loadLanguages()
utility, which will automatically handle any required dependencies.
+
+
+
diff --git a/test/html/logo.svg b/test/html/logo.svg
new file mode 100644
index 0000000..698d292
--- /dev/null
+++ b/test/html/logo.svg
@@ -0,0 +1,23 @@
+
+
+ topic
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
+
+ This page’s logo (SVG), highlighted with Prism:
+
+
+
+
+ Example:
+ var Prism = require('prismjs');
+
+// The code snippet you want to highlight, as a string
+var code = "var data = 1;";
+
+// Returns a highlighted HTML string
+var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
+
+ Requiring prismjs will load the default languages: markup, css,
+ clike and javascript. You can load more languages with the
+ loadLanguages() utility, which will automatically handle any required dependencies.
+
+
+
\ No newline at end of file
diff --git a/test/javadoc/build.xml b/test/javadoc/build.xml
new file mode 100644
index 0000000..7900b26
--- /dev/null
+++ b/test/javadoc/build.xml
@@ -0,0 +1,12 @@
+
+
+ topic
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
+
+
Example Java
+
+
+
+package helloworldapp;
+
+
+public class HelloWorldApp {
+
+
+
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
+ }
+
+}
+
+
+
Example Dockerfile
+
+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+ADD target/hello-docker-0.0.1-SNAPSHOT.jar hello-docker-app.jar
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /hello-docker-app.jar" ]
+
+
+
Example no highlights
+
+Plain text = ""
+
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
+
+
+
diff --git a/test/load-libraries/logo.svg b/test/load-libraries/logo.svg
new file mode 100644
index 0000000..698d292
--- /dev/null
+++ b/test/load-libraries/logo.svg
@@ -0,0 +1,23 @@
+
+
+ topic
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
+
+ This page’s logo (SVG), highlighted with Prism:
+
+
+
+
+ Example:
+ var Prism = require('prismjs');
+
+// The code snippet you want to highlight, as a string
+var code = "var data = 1;";
+
+// Returns a highlighted HTML string
+var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
+
+ Requiring prismjs will load the default languages: markup, css,
+ clike and javascript. You can load more languages with the
+ loadLanguages() utility, which will automatically handle any required dependencies.
+
+
+
\ No newline at end of file
diff --git a/test/setup.sh b/test/setup.sh
new file mode 100755
index 0000000..c7f70da
--- /dev/null
+++ b/test/setup.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# This file is part of the DITA-OT Prism-JS Plug-in project.
+set -e
+
+apt-get update -q
+export DEBIAN_FRONTEND=noninteractive
+apt-get install -qy --no-install-recommends nodejs
+nodejs -v
\ No newline at end of file