Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pseudocode-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
We are moving to Forgejo!
You are on a read-only GitLab instance.
Show more breadcrumbs
Jeffrey Phillips Freeman
pseudocode-js
Commits
7dd622c3
Commit
7dd622c3
authored
10 years ago
by
Tate, Hongliang Tian
Browse files
Options
Downloads
Patches
Plain Diff
Use new version
parent
957cae41
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pseudocode/README.md
+30
-17
30 additions, 17 deletions
pseudocode/README.md
pseudocode/pseudocode.min.js
+4
-4
4 additions, 4 deletions
pseudocode/pseudocode.min.js
with
34 additions
and
21 deletions
pseudocode/README.md
+
30
−
17
View file @
7dd622c3
...
...
@@ -3,16 +3,24 @@
Pseudocode.js is a JavaScript library that typesets pseudocode beautifully to
HTML.
Pseudocode.js accepts a TeX-style input that borrows the algorithmic constructs
from LaTeX's algorithm packages and produces a HTML output that looks (almost)
identical to its LaTeX counterpart. The usage of a TeX-style grammar enables
simple construction of math formulas. And any user who already has some LaTeX
experience should find pseudocode.js very intuitive.
*
**Intuitive grammar**
: Pseudocode.js takes a LaTeX-style input that supports
the algorithmic constructs from LaTeX's algorithm packages. With or without
LaTeX experience, a user should find the grammar fairly intuitive.
*
**Print quality:**
The HTML output produced by pseudocode.js is (almost)
identical with the pretty algorithms printed on publications that are
typeset by LaTeX.
*
**Math formula support:**
Inserting math formulas in pseudocode.js is as easy
as LaTeX. Just enclose math expression in
`$...$`
or
`\(...\)`
.
It supports all modern browsers, including Chrome, Safari,
Firefox, Opera, and IE 8 - IE 11.
## Demo
Visit the
[
project website
](
http://www.tatetian.me/pseudocode.js
)
for demo.
## Usage
### Basics
Download
[
pseudocode.js
](
https://github.com/tatetian/pseudocode.js/releases
)
,
and host the files on your server. And then include the
`js`
and
`css`
files in
your HTML files:
...
...
@@ -52,14 +60,6 @@ var htmlStr = pseudocode.renderToString(code, options);
console
.
log
(
htmlStr
);
```
## Features
There are several packages for typesetting algorithms in LaTeX, among which
[
`algorithmic`
](
http://mirror.ctan.org/tex-archive/macros/latex/contrib/algorithms/algorithms.pdf
)
package is the most simple and intuitive, and is chosen by IEEE in its
[
LaTeX template file
](
http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran
)
.
The grammar of Pseudocode.js is mostly compatible with
`algorithmic`
package with
a few improvement to make it even more easier to use.
### Example
To give you a sense of the grammar for pseudocode, here is an example that
illustrates a quicksort algorithm:
...
...
@@ -92,6 +92,12 @@ illustrates a quicksort algorithm:
```
### Grammar
There are several packages for typesetting algorithms in LaTeX, among which
[
`algorithmic`
](
http://mirror.ctan.org/tex-archive/macros/latex/contrib/algorithms/algorithms.pdf
)
package is the most simple and intuitive, and is chosen by IEEE in its
[
LaTeX template file
](
http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran
)
.
The grammar of pseudocode.js is mostly compatible with
`algorithmic`
package with
a few improvement to make it even more easier to use.
Commands for typesetting algorithms must be enclosed in an
`algorithmic`
environment:
```
tex
...
...
@@ -165,13 +171,13 @@ $i \gets i + 1$
normal text
{
\small
the size gets smaller
}
back to normal again
```
Note that although
P
seudocode.js recognizes some LaTeX commands, it is by no
Note that although
p
seudocode.js recognizes some LaTeX commands, it is by no
means a full-featured LaTeX implementation in JavaScript.
It only support a subset of LaTeX commands that are most relevant to
typesetting algorithms.
To display the caption of an algorithm, use
`algorithm`
environ
t
ment as a 'float' wrapper :
To display the caption of an algorithm, use
`algorithm`
environment as a 'float' wrapper :
```
tex
\begin{algorithm}
\caption
{
The caption of your algorithm
}
...
...
@@ -206,6 +212,13 @@ var DEFAULT_OPTIONS = {
captionCount: undefined
};
``
`
## Author
Tate Tian (
[
@tatetian
](
https://github.com/tatetian
)
) creates pseudocode.js. Any
suggestions and bug reports are welcome.
## Acknowledgement
Pseudocode.js is powered by
[
KaTeX
](
http://khan.github.io/KaTeX
)
to render math formulas.
Pseudocode.js is partially inspired by
[
KaTeX
](
http://khan.github.io/KaTeX/
)
and
relies on it to render math formulas.
Thanks Emily Eisenberg(
[
@xymostech
](
https://github.com/xymostech
)
)
and other contributers for building such a wonderful project.
This diff is collapsed.
Click to expand it.
pseudocode/pseudocode.min.js
+
4
−
4
View file @
7dd622c3
source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment