prep docs

This commit is contained in:
Leo 2017-01-30 10:43:22 -05:00
parent 81efa4db49
commit 431436bd6a
8 changed files with 339 additions and 32 deletions

View file

@ -8,6 +8,8 @@ try {fs.mkdirSync("../mithril/archive")} catch (e) {}
try {fs.mkdirSync("../mithril/archive/v" + version)} catch (e) {}
try {fs.mkdirSync("../mithril/archive/v" + version + "/lib")} catch (e) {}
try {fs.mkdirSync("../mithril/archive/v" + version + "/lib/prism")} catch (e) {}
try {fs.mkdirSync("../mithril/lib")} catch (e) {}
try {fs.mkdirSync("../mithril/lib/prism")} catch (e) {}
var guides = fs.readFileSync("docs/guides.md", "utf-8")
var methods = fs.readFileSync("docs/methods.md", "utf-8")
@ -45,7 +47,9 @@ function generate(pathname) {
}) // fix links
var markedHtml = marked(fixed)
.replace(/(\W)Array<([^/<]+?)>/gim, "$1Array&lt;$2&gt;") // Fix type signatures containing Array<...>
var title = fixed.match(/^#([^\n\r]+)/i) || []
var html = layout
.replace(/<title>Mithril\.js<\/title>/, "<title>" + title[1] + " - Mithril.js</title>")
.replace(/\[version\]/, version) // update version
.replace(/\[body\]/, markedHtml)
.replace(/<h5 id="([^"]+?)">([^<]+?)<\/h5>/gim, function(match, id, text) { // fix anchors

View file

@ -60,7 +60,7 @@ Let's create an HTML file to follow along:
```markup
<body></body>
<script src="http://cdn.rawgit.com/lhorie/mithril.js/rewrite/mithril.js"></script>
<script src="http://unpkg.com/mithril/mithril.js"></script>
<script>
var root = document.body

View file

@ -8,7 +8,7 @@
If you're new to Javascript or just want a very simple setup to get your feet wet, you can get Mithril from a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network):
```markup
<script src="http://cdn.rawgit.com/lhorie/mithril.js/rewrite/mithril.js"></script>
<script src="http://unpkg.com/mithril/mithril.js"></script>
```
---
@ -19,7 +19,7 @@ If you're new to Javascript or just want a very simple setup to get your feet we
```bash
# 1) install
npm install mithril@rewrite --save
npm install mithril --save
npm install webpack --save
@ -55,7 +55,7 @@ npm init --yes
Then, to install Mithril, run:
```bash
npm install mithril@rewrite --save
npm install mithril --save
```
This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
@ -178,7 +178,7 @@ Live reload is a feature where code changes automatically trigger the page to re
```bash
# 1) install
npm install mithril@rewrite --save
npm install mithril --save
npm install budo -g
# 2) add this line into the scripts section in package.json

View file

@ -9,7 +9,8 @@
<body>
<header>
<section>
<h1>Mithril <small>[version]</small></h1>
<a class="hamburger" href="javascript:;"></a>
<h1><img src="logo.svg"> Mithril <small>[version]</small></h1>
<nav>
<a href="index.html">Guide</a>
<a href="api.html">API</a>
@ -26,5 +27,13 @@
</section>
</main>
<script src="lib/prism/prism.js"></script>
<script>
document.querySelector(".hamburger").onclick = function() {
document.body.className = 'navigating'
document.querySelector("h1 + ul").onclick = function() {
document.body.className = ''
}
}
</script>
</body>
</html

54
docs/logo.svg Normal file
View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 38.044 38.044" style="enable-background:new 0 0 38.044 38.044;" xml:space="preserve">
<g>
<g>
<path style="fill:#010002;" d="M31.716,13.5C31.699,6.47,25.974,0.755,18.94,0.755c-7.045,0-12.777,5.732-12.777,12.777
c0,0.022,0.004,0.043,0.004,0.065C2.477,15.84,0,19.887,0,24.511c0,7.046,5.731,12.777,12.777,12.777
c2.268,0,4.395-0.601,6.244-1.642c1.849,1.041,3.977,1.642,6.245,1.642c7.046,0,12.777-5.732,12.777-12.777
C38.043,19.82,35.495,15.722,31.716,13.5z M19.021,32.961c-2.312-1.713-3.906-4.341-4.22-7.352c1.3,0.448,2.689,0.702,4.139,0.702
c1.514,0,2.96-0.278,4.307-0.764C22.949,28.584,21.349,31.236,19.021,32.961z M8.517,14.898c1.303-0.579,2.743-0.909,4.26-0.909
c1.475,0,2.879,0.307,4.154,0.858c-2.114,1.826-3.629,4.325-4.195,7.167C10.473,20.352,8.898,17.814,8.517,14.898z M18.94,24.055
c-1.457,0-2.846-0.298-4.109-0.837c0.361-2.928,1.929-5.482,4.19-7.157c2.243,1.662,3.802,4.187,4.18,7.085
C21.897,23.727,20.457,24.055,18.94,24.055z M21.111,14.846c1.275-0.55,2.679-0.858,4.154-0.858c1.457,0,2.846,0.298,4.11,0.837
c-0.356,2.885-1.883,5.404-4.089,7.082C24.704,19.108,23.199,16.65,21.111,14.846z M18.94,3.01c5.432,0,9.915,4.137,10.466,9.425
c-1.3-0.447-2.689-0.702-4.14-0.702c-2.268,0-4.396,0.601-6.245,1.642c-1.848-1.041-3.975-1.642-6.244-1.642
c-1.514,0-2.96,0.278-4.307,0.763C8.993,7.179,13.488,3.01,18.94,3.01z M12.777,35.034c-5.803,0-10.523-4.72-10.523-10.523
c0-3.418,1.645-6.451,4.177-8.375c0.744,3.581,2.999,6.607,6.059,8.408c0.011,3.847,1.735,7.293,4.442,9.631
C15.656,34.727,14.253,35.034,12.777,35.034z M25.266,35.034c-1.475,0-2.879-0.307-4.154-0.858
c2.715-2.345,4.444-5.804,4.444-9.664c0-0.022-0.004-0.044-0.004-0.065c3.007-1.829,5.209-4.852,5.918-8.416
c2.613,1.917,4.319,4.999,4.319,8.48C35.788,30.313,31.068,35.034,25.266,35.034z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -10,6 +10,7 @@ h2 {font-size:22px;margin:45px 0 15px;}
h3 {font-size:20px;margin:45px 0 15px;}
h4 {font-size:18px;margin:30px 0 15px;}
h5 {font-weight:bold;margin:15px 0 15px;}
h1 img {transform:rotate(180deg);vertical-align:middle;width:20px;}
h1 small {font-size:16px;}
p {margin:0 0 15px;}
pre,code {background:#eee;font-family:monospace;font-size:14px;}
@ -35,10 +36,17 @@ h1 + ul ul {margin:0 0 2px;padding:0 0 0 15px;}
h1 + ul ul li {border:0;}
h1 + ul strong + ul {border-left:3px solid #1e5799;}
.hamburger {display:none;}
@media (max-width: 767px) {
.hamburger {display:block;font-size:30px;padding:0 10px;position:fixed;right:0;top:0;}
.hamburger:hover {text-decoration:none;}
main section {margin:0;}
header section {margin:0 0 20px;position:static;width:auto;}
h1 + ul {background:#eee;border:1px solid #ccc;box-sizing:border-box;display:none;height:100%;margin:0;overflow:auto;padding:20px;position:fixed;right:0;top:0;width:100%;}
h1 + ul + hr {display:block;}
header section,h1 + ul {margin:0 0 20px;position:static;width:auto;}
.navigating h1 + ul {display:block;}
.navigating {overflow:hidden;}
}
@media (max-width: 1024px) {
table,table tbody,table tr,table th,table td {display:block;}
@ -62,3 +70,7 @@ h1 + ul strong + ul {border-left:3px solid #1e5799;}
#vue ~ table td:nth-child(1):before {content:"Vue:";}
#comparisons ~ table td:nth-child(2):before {content:"Mithril:";}
}
@media print {
nav,h1 + ul {display:none;}
main section {margin:0;}
}