diff --git a/.eslintrc b/.eslintrc index a01556e..eeaca04 100644 --- a/.eslintrc +++ b/.eslintrc @@ -17,7 +17,7 @@ "max-len": [2, 84, 4, { "ignoreUrls": true, "ignorePattern": "\\brequire\\([\"']|eslint-disable", "ignoreComments": true, }], "no-alert": 2, "no-array-constructor": 2, - "no-console": 2, + "no-console": 0, "no-const-assign": 2, "no-constant-condition": 0, "no-debugger": 2, diff --git a/Makefile b/Makefile index 22cd6f0..aead26c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: all build clean docs default lint release setup -VERSION=2.0.0 +VERSION=2.1.0 # Building tools BROWSERIFY = $(realpath ./node_modules/.bin/browserify) @@ -15,11 +15,12 @@ UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \ SAMPLES = build/katex-samples.html build/mathjax-v2-samples.html build/mathjax-v3-samples.html -all : clean build docs release - default: build +all : clean build docs release + + setup: static/katex/ npm install @echo "> Node.js packages installed" @@ -42,7 +43,7 @@ build: build/pseudocode.js build/pseudocode.css $(SAMPLES) build/pseudocode.js: pseudocode.js $(wildcard src/*.js) @$(MAKE) --no-print-directory lint - $(BROWSERIFY) $< --exclude katex --standalone pseudocode -o $@ + $(BROWSERIFY) $< --exclude mathjax --exclude katex --standalone pseudocode -o $@ lint: pseudocode.js $(wildcard src/*.js) $(ESLINT) $^ @@ -50,12 +51,12 @@ lint: pseudocode.js $(wildcard src/*.js) build/pseudocode.css: static/pseudocode.css cp static/pseudocode.css build/pseudocode.css -build/%-samples.html: static/%-samples.html.template - cp $< $@ +build/%-samples.html: static/%.html.part static/body.html.part static/footer.html.part + cat $^ > $@ -release: build build/pseudocode-js.tar.gz build/pseudocode-js.zip +release: build docs build/pseudocode-js.tar.gz build/pseudocode-js.zip @echo "> Release package generated" RELEASE_DIR=pseudocode.js-$(VERSION)/ diff --git a/README.md b/README.md index 92d0bae..70cffd7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# pseudocode.js - Beautiful pseudocode for the Web +# pseudocode.js @@ -122,11 +122,7 @@ Insert the following Javascript snippet at the end of your document: ```html ``` @@ -236,8 +232,15 @@ To display the caption of an algorithm, use `algorithm` environment as a 'float' ``` ### Options -Function `pseudocode.renderToString` and `pseudocode.renderToString` can accept -an option as the last argument. +`pseudocode.renderElement` can accept an option as the last argument, +such as + +```js +pseudocode.renderElement(document.getElementById("quicksort"). + { lineNumber: true }); +``` + +The following options are currently supported: * `indentSize`: The indent size of inside a control block, e.g. if, for, etc. The unit must be in 'em'. @@ -249,7 +252,8 @@ an option as the last argument. showned. * `captionCount`: Reset the caption counter to this number. -The values of the options, if not reset specifically, are: +The default values of these options are: + ```js var DEFAULT_OPTIONS = { indentSize: '1.2em', diff --git a/docs/index.html b/docs/index.html index 816babd..34a5acb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -93,6 +93,24 @@

+ + - -


- - » View KaTeX Samples
- » View MathJax 2.0 Samples
- » View MathJax 3.0 Samples