Skip to content

Commit 84b8598

Browse files
committed
minor improvements to docs
1 parent 9f99c3f commit 84b8598

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.PHONY: build clean docs default lint release setup
1+
.PHONY: all build clean docs default lint release setup
22

3-
VERSION=2.0
3+
VERSION=2.0.0
44

55
# Building tools
66
BROWSERIFY = $(realpath ./node_modules/.bin/browserify)
@@ -15,6 +15,8 @@ UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \
1515
SAMPLES = build/katex-samples.html build/mathjax-v2-samples.html build/mathjax-v3-samples.html
1616

1717

18+
all : clean build docs release
19+
1820
default: build
1921

2022

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pseudocode.js - Beautiful pseudocode for the Web
22

3-
<img align="right" width="42%" src="docs/screenshot.png">
3+
<img align="right" width="40%" src="docs/screenshot.png">
44

55
**pseudocode.js** is a JavaScript library that typesets pseudocode beautifully to
66
HTML.
@@ -17,9 +17,7 @@ HTML.
1717
It supports all modern browsers, including Chrome, Safari, Firefox, Edge, and
1818
IE 9 - IE 11.
1919

20-
21-
## Demo
22-
Visit the [project website](https://saswatpadhi.github.io/pseudocode.js) for demo.
20+
Visit the [project website](https://saswatpadhi.github.io/pseudocode.js) for a demo.
2321

2422

2523
## Usage
@@ -89,7 +87,7 @@ Then include the following in the `<head>` of your page:
8987
We assume the pseudocode to be rendered is in a `<pre>` DOM element.
9088
Here is an example that illustrates a quicksort algorithm:
9189

92-
```tex
90+
```html
9391
<pre id="quicksort" style="display:hidden;">
9492
% This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition)
9593
\begin{algorithm}
@@ -124,7 +122,7 @@ Insert the following Javascript snippet at the end of your document:
124122

125123
```html
126124
<script>
127-
var elem = document.getElementById("hello-world-code");
125+
var elem = document.getElementById("quicksort");
128126
var options = {
129127
lineNumber: true
130128
};

docs/index.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
<body>
8282
<div class="wrapper">
8383
<header>
84-
<h1>pseudocode.js</h1>
84+
<h1>
85+
<a href="https://saswatpadhi.github.io/pseudocode.js/">pseudocode.js</a>
86+
</h1>
8587
<p>Beautiful pseudocode for the Web</p>
8688

8789
<p class="view">
@@ -108,11 +110,20 @@ <h1>pseudocode.js</h1>
108110
</a>
109111
</li>
110112
</ul>
113+
114+
<br><br><br>
115+
116+
&raquo; <a onclick="load('katex-samples.html')">View KaTeX Samples</a> <br>
117+
&raquo; <a onclick="load('mathjax-v2-samples.html')">View MathJax 2.0 Samples</a> <br>
118+
&raquo; <a onclick="load('mathjax-v3-samples.html')">View MathJax 3.0 Samples</a> <br>
111119
</header>
112120

113-
<section>
114-
<h3>Demo</h3>
121+
<section id='samples' style='display: none; padding-bottom: 0;'>
122+
<iframe id='samples-frame'>
123+
</iframe>
124+
</section>
115125

126+
<section id='content'>
116127
<p>pseudocode.js enables JavaScript to typeset algorithms as <em>beautifully</em>
117128
as LaTeX does: </p>
118129

@@ -255,6 +266,15 @@ <h3>Acknowledgement</h3>
255266
<script>
256267
hljs.initHighlightingOnLoad();
257268

269+
function load(page) {
270+
document.getElementById('content').style.display = 'none';
271+
document.getElementById('samples').style.display = 'block';
272+
273+
var frame = document.getElementById('samples-frame');
274+
frame.setAttribute('src', page);
275+
frame.height = window.innerHeight - frame.offsetTop - 32 + 'px';
276+
}
277+
258278
var editorEl = document.getElementsByClassName('demo-editor')[0];
259279

260280
function renderPseudocode() {

docs/katex-samples.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<title>pseudocode.js Samples with KaTeX</title>
77

88
<!-- Setup KaTeX -->
9-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css"
10-
integrity="sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung=" crossorigin="anonymous" />
119
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js"
1210
integrity="sha256-F/Xda58SPdcUCr+xhSGz9MA2zQBPb0ASEYKohl8UCHc=" crossorigin="anonymous">
1311
</script>

docs/stylesheets/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ body {
55
font-weight:300;
66
}
77

8+
iframe {
9+
border: none;
10+
width: 115%;
11+
}
12+
813
h1, h2, h3, h4, h5, h6 {
914
color:#222;
1015
margin:0 0 20px;

static/katex-samples.html.template

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<title>pseudocode.js Samples with KaTeX</title>
77

88
<!-- Setup KaTeX -->
9-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css"
10-
integrity="sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung=" crossorigin="anonymous" />
119
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js"
1210
integrity="sha256-F/Xda58SPdcUCr+xhSGz9MA2zQBPb0ASEYKohl8UCHc=" crossorigin="anonymous">
1311
</script>

0 commit comments

Comments
 (0)