-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
112 lines (77 loc) · 3.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Enable JavaScript for HTML output! <pre>
= Hello, Dr!
:toc: preamble
:Author: Jonathon Fernyhough
image::http://lorempixel.com/1000/300/[]
Inspired by https://github.com/Xeoncross/Jr[Jr], _Dr_ is a static-static content
generator for AsciiDoc-formatted documents. Have a look at the page source!
== What is AsciiDoc?
[quote, AsciiDoc website, http://asciidoctor.org/docs/what-is-asciidoc/]
____
AsciiDoc is two things:
* A mature, plain-text writing format for authoring notes, articles,
documentation, books, ebooks, web pages, slide decks, blog posts, man pages
and more.
* A text processor and toolchain for translating AsciiDoc documents into various
formats (called backends), including HTML, DocBook, PDF and ePub.
____
Visit the http://asciidoc.org[AsciiDoc site] for an introduction to AsciiDoc.
== How this works
All pages are plain text with a single Javascript entrypoint included on each page.
The Javascript then parses the AsciiDoc and renders the theme and assets as needed.
In common with Jr, this means:
* minimal bandwidth requirements
* better search engine indexing
* awesome screen reader support
but, because it's AsciiDoc, you get many more features compared to Markdown. File
includes, image embedding, proper tabular data, a table of content, footnotes, ...
== How do I use it?
. Write your AsciiDoc document
. Add the following tag to the end:
[source,html]
<script data-main="js/dr" src="js/require.js"></script>
. Save it with a `.html` file extension and view it in a browser.
== Components
The _Dr_ project is based around several components:
* A tweaked `asciidocify.js` that takes care of the AsciiDoc input, taken from the
https://github.com/asciidoctor/asciidoctor-firefox-addon[Asciidoctor Firefox addon];
* https://github.com/asciidoctor/asciidoctor.js[asciidoctor.js] for the conversion back-end;
* https://github.com/google/code-prettify[prettify] for syntax highlighting;
* http://requirejs.org[RequireJS] for a single entry point and post-load actions.
== Example elements
.Numbered list
. item 1.footnote:[This might not actually be first]
. item 2
.Source code
[source,ruby]
area = "World"
puts "Hello, #{area}"
[source,bash]
for i in Hello World; do
echo $i
done
.Tabular data from CSV items
[format="csv", options="header"]
|===
Artist,Track,Genre
Baauer,Harlem Shake,Hip Hop
The Lumineers,Ho Hey,Folk Rock
|===
== Additional scripts
Additional scripts can be included to gain extra functionality; the additional
script just needs to be included somewhere, whether as an element on an
individual page, or within `js/dr.js`. For example, the following elements use
https://www.mathjax.org/[MathJax].
.LaTeX Math
latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]
.MathJax
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\)
.LaTeXMathML
latexmath:[$\sum_{n=1}^\infty \frac{1}{2^n}$]
See the http://asciidoc.org/userguide.html#X78[AsciiDoc user guide] for more
information on including mathematical formulae.
<script data-main="js/dr" src="js/require.js"></script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
</script>