diff --git a/README.md b/README.md index 28dcb1f..bbcdda0 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ We assume the pseudocode to be rendered is in a `
` DOM element. Here is an example that illustrates a quicksort algorithm: ```html -+% This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition) \begin{algorithm} \caption{Quicksort} @@ -116,7 +116,7 @@ Here is an example that illustrates a quicksort algorithm:``` -#### Step 4 · Render the element using pseudocode.js +#### Step 4A · Render the element using pseudocode.js Insert the following Javascript snippet at the end of your document: ```html @@ -125,6 +125,14 @@ Insert the following Javascript snippet at the end of your document: ``` +#### Step 4B · Render the class using pseudocode.js +Insert the following Javascript snippet at the end of your document: + +```html + +``` ### Grammar There are several packages for typesetting algorithms in LaTeX, among which diff --git a/pseudocode.js b/pseudocode.js index d7bb00e..f6e1f0e 100644 --- a/pseudocode.js +++ b/pseudocode.js @@ -66,4 +66,11 @@ module.exports = { } } }, + + renderClass: function(class_name, options) { + [].forEach.call( + document.getElementsByClassName(class_name), + function (el) { this.renderElement(el, options); } + ); + }, };