StrapDown.js v0.8 : adding an option ?nonnavbar=y to remove the top navbar (thanks @sebastienkrut).
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
1. *Directly write your documents in Markdown*, and let the browser do the boring *compilation* steps,
|
||||
2. no need for CSS, theming or painful styling: *StrapDown.js* is already *friggin' beautiful*, and *responsive*,
|
||||
3. *quick* and *secure*, thanks to *GitHub* and their great SSL support. Note : You can also use [https://cdn.rawgit.com/Naereen/StrapDown.js/master/strapdown.min.js](https://cdn.rawgit.com/Naereen/StrapDown.js/master/strapdown.min.js) to load the script from a quick and secure (HTTPS-aware) CDN.
|
||||
4. comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>...
|
||||
4. comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>, <a href="example9.html" title="Example 9">9th</a>, <a href="example10.html" title="Example 10">10th</a>...
|
||||
5. an almost perfect support for *text-only* browsers (as w3m, links, or elinks): *pure Markdown* is simpler to read than complicated HTML full of javascript, images (or worse),
|
||||
6. no external dependencies other than itself (and [MathJax](http://www.mathjax.org/) if you want to include it),
|
||||
7. no spying, no logging, no external leaking of your pages (and [Google Analytics with a 1px beacon image](http://perso.crans.org/besson/beacon.html) can be included with an option,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
1. *Directly write your documents in Markdown*, and let the browser do the boring *compilation* steps,
|
||||
2. no need for CSS, theming or painful styling: *StrapDown.js* is already *friggin' beautiful*, and *responsive*,
|
||||
3. *quick* and *secure*, thanks to *GitHub* and their great SSL support. Note : You can also use [https://cdn.rawgit.com/Naereen/StrapDown.js/master/strapdown.min.js](https://cdn.rawgit.com/Naereen/StrapDown.js/master/strapdown.min.js) to load the script from a quick and secure (HTTPS-aware) CDN.
|
||||
4. comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>...
|
||||
4. comes with many examples: [first](example1.html), [second](example2.html), [third](example3.html), [4th](example4.html), [5th](example5.html), [6th](example6.html), [7th](example7.html), [8th](example8.html), [9th](example9.html), [10th](example10.html)...
|
||||
5. an almost perfect support for *text-only* browsers (as w3m, links, or elinks): *pure Markdown* is simpler to read than complicated HTML full of javascript, images (or worse),
|
||||
6. no external dependencies other than itself (and [MathJax](http://www.mathjax.org/) if you want to include it),
|
||||
7. no spying, no logging, no external leaking of your pages (and [Google Analytics with a 1px beacon image](http://perso.crans.org/besson/beacon.html) can be included with an option,
|
||||
|
@@ -16,8 +16,9 @@ This way, some options are available:
|
||||
2. ``theme=united`` or ``theme=cyborg`` if you want to load a specific theme (without having to specify it as the ``theme`` attribute of the main ``xmp`` tag containing your Markdown code),
|
||||
3. ``beacon=y`` if you want to include an invisible [GA Beacon](http://perso.crans.org/besson/beacon.en.html) image in your page,
|
||||
4. ``pedantic=y`` if you want to force the use of the ["pedantic" option](https://github.com/chjj/marked#pedantic) for [marked](https://github.com/chjj/marked), the Markdown parser used by StrapDown.js (note: you probably don't want that, [pedantic=false is usually better](https://github.com/chuckhoupt/strapdown/commit/1a090729fb717059be0689aa65025de6de67b3cd)). Default is pedantic=false.
|
||||
5. ``nonavbarfixed=y`` if you prefer the [top navigation bar](https://bootswatch.com/united/#navbar) to not be fixed, but scroll as the rest of the page (*new!*). See [example8](example8.html),
|
||||
6. ``keepicon=y`` if you prefer StrapDown.js to keep the favicon included in your HTML document (*new!*). See [example9](example9.html).
|
||||
5. ``nonavbarfixed=y`` if you prefer the [top navigation bar](https://bootswatch.com/united/#navbar) to not be fixed, but scroll as the rest of the page (*new!*). See [example #8](example8.html),
|
||||
6. ``keepicon=y`` if you prefer StrapDown.js to keep the favicon included in your HTML document (*new!*). See [example #9](example9.html).
|
||||
7. ``nonavbar=y`` if you prefer to not have any [top navigation bar](https://bootswatch.com/united/#navbar) (*new!*). See [example #10](example10.html),
|
||||
|
||||
***
|
||||
|
||||
|
BIN
example5.pdf
BIN
example5.pdf
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"/><title>Example with StrapDown.js without fix top navbar</title></head><body><xmp theme="united">
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"/><title>Example with StrapDown.js with non-fix top navbar</title></head><body><xmp theme="united">
|
||||
<ul class="pager">
|
||||
<li class="previous"><a href="example7.html">← Previous example</a></li>
|
||||
<li><a href="index.html">Index</a></li>
|
||||
|
BIN
example8.pdf
BIN
example8.pdf
Binary file not shown.
@@ -8,7 +8,7 @@
|
||||
<ul class="pager">
|
||||
<li class="previous"><a href="example8.html">← Previous example</a></li>
|
||||
<li><a href="index.html">Index</a></li>
|
||||
<li class="next disabled"><a href="#">(Last example)</a></li>
|
||||
<li class="next"><a href="example10.html">(Last example)</a></li>
|
||||
</ul>
|
||||
|
||||
# This is a Markdown document
|
||||
@@ -68,7 +68,7 @@ This was a brief overview, to show the basic use of [StrapDown.js](index.html).
|
||||
<ul class="pager">
|
||||
<li class="previous"><a href="example8.html">← Previous example</a></li>
|
||||
<li><a href="index.html">Index</a></li>
|
||||
<li class="next disabled"><a href="#">(Last example)</a></li>
|
||||
<li class="next"><a href="example10.html">(Last example)</a></li>
|
||||
</ul>
|
||||
|
||||
</xmp><script type="text/javascript" src="strapdown.min.js?keepicon=y"></script></body></html>
|
||||
|
BIN
example9.pdf
BIN
example9.pdf
Binary file not shown.
@@ -9,7 +9,7 @@ to <a href="https://en.wikipedia.org/wiki/HTML">HTML</a> <a href="https://en.wik
|
||||
<li><em>Directly write your documents in Markdown</em>, and let the browser do the boring <em>compilation</em> steps,</li>
|
||||
<li>no need for CSS, theming or painful styling: <em>StrapDown.js</em> is already <em>friggin' beautiful</em>, and <em>responsive</em>,</li>
|
||||
<li><em>quick</em> and <em>secure</em>, thanks to <em>Bitbucket</em> and their SSL support (even if the certificate is not valid for <a href="https://lbesson.bitbucket.org">https://lbesson.bitbucket.org</a>, it is still secure),</li>
|
||||
<li>comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>...</li>
|
||||
<li>comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>, <a href="example9.html" title="Example 9">9th</a>, <a href="example10.html" title="Example 10">10th</a>...</li>
|
||||
<li>an almost perfect support for <em>text-only</em> browsers (as w3m, links, or elinks): <em>pure Markdown</em> is simpler to read than complicated HTML full of javascript, images (or worse),</li>
|
||||
<li>no external dependencies other than itself (and <a href="http://www.mathjax.org/">MathJax</a> if you want to include it),</li>
|
||||
<li>no spying, no logging, no external leaking of your pages (and <a href="http://perso.crans.org/besson/beacon.html">Google Analytics with a 1px beacon image</a> can be included with an option, and unfortunately <a href="https://confluence.atlassian.com/display/BITBUCKET/Publishing+a+Website+on+Bitbucket#PublishingaWebsiteonBitbucket-TechnicalFeaturesandLimitationsofthisFeature">rum.js from Bitbucket hosting server</a>),</li>
|
||||
|
@@ -9,7 +9,7 @@ to [HTML](https://en.wikipedia.org/wiki/HTML) [text processor](https://en.wikipe
|
||||
1. *Directly write your documents in Markdown*, and let the browser do the boring *compilation* steps,
|
||||
2. no need for CSS, theming or painful styling: *StrapDown.js* is already *friggin' beautiful*, and *responsive*,
|
||||
3. *quick* and *secure*, thanks to *Bitbucket* and their SSL support (even if the certificate is not valid for [https://lbesson.bitbucket.org](https://lbesson.bitbucket.org), it is still secure),
|
||||
4. comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>...
|
||||
4. comes with many examples: <a href="example1.html" title="Example 1">first</a>, <a href="example2.html" title="Example 2">second</a>, <a href="example3.html" title="Example 3">third</a>, <a href="example4.html" title="Example 4">4th</a>, <a href="example5.html" title="Example 5">5th</a>, <a href="example6.html" title="Example 6">6th</a>, <a href="example7.html" title="Example 7">7th</a>, <a href="example8.html" title="Example 8">8th</a>, <a href="example9.html" title="Example 9">9th</a>, <a href="example10.html" title="Example 10">10th</a>...
|
||||
5. an almost perfect support for *text-only* browsers (as w3m, links, or elinks): *pure Markdown* is simpler to read than complicated HTML full of javascript, images (or worse),
|
||||
6. no external dependencies other than itself (and [MathJax](http://www.mathjax.org/) if you want to include it),
|
||||
7. no spying, no logging, no external leaking of your pages (and [Google Analytics with a 1px beacon image](http://perso.crans.org/besson/beacon.html) can be included with an option, and unfortunately [rum.js from Bitbucket hosting server](https://confluence.atlassian.com/display/BITBUCKET/Publishing+a+Website+on+Bitbucket#PublishingaWebsiteonBitbucket-TechnicalFeaturesandLimitationsofthisFeature)),
|
||||
@@ -85,6 +85,7 @@ And, yes, it is **as simple** as **one** HTML line at the beginning and **one**
|
||||
<li><a href="example7.html" title="Example 7">#7</a></li>
|
||||
<li><a href="example8.html" title="Example 8">#8</a></li>
|
||||
<li><a href="example9.html" title="Example 9">#9</a></li>
|
||||
<li><a href="example10.html" title="Example 10">#10</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -163,6 +164,7 @@ as shown in these three examples: [example n°3](example3.html) and [example n°
|
||||
<li><a href="example7.html" title="Example 7">#7</a></li>
|
||||
<li><a href="example8.html" title="Example 8">#8</a></li>
|
||||
<li><a href="example9.html" title="Example 9">#9</a></li>
|
||||
<li><a href="example10.html" title="Example 10">#10</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
10
strapdown.js
10
strapdown.js
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* StrapDown.js - an on-the-fly markdown parser
|
||||
* Copyright (C) 2015, Lilian Besson. (GPLv3 Licensed)
|
||||
* Copyright (C) 2016, Lilian Besson. (GPLv3 Licensed)
|
||||
* http://lbesson.bitbucket.org/md/
|
||||
* https://GitHub.com/Naereen/StrapDown.js
|
||||
* Version: 0.6
|
||||
* Version: 0.8
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -461,7 +461,7 @@ var PR=win['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':re
|
||||
if (!navbarEl && titleEl) {
|
||||
newNode.innerHTML = '<div class="navbar-inner"> <div class="container"> <div id="headline" class="brand"> </div> '
|
||||
+ '<div id="headline-copyrights" class="brand">('
|
||||
+ '<a title="http://lbo.k.vu/md" href="http://lbesson.bitbucket.org/md/index.html?src=strapdown.js">StrapDown.js</a> v0.7, '
|
||||
+ '<a title="http://lbo.k.vu/md" href="http://lbesson.bitbucket.org/md/index.html?src=strapdown.js">StrapDown.js</a> v0.8, '
|
||||
+ 'theme <a title="More information on this theme on bootswatch.com!" href="http://bootswatch.com/'+theme+'">'+theme+'</a>, '
|
||||
+ 'thanks to <a href="https://bitbucket.org/">BitBucket</a>)</div> '
|
||||
+ '<div id="headline-squirt" class="brand"> <a title="Quick reader script! Check http://lbesson.bitbucket.org/squirt/ for more details" '
|
||||
@@ -471,7 +471,9 @@ var PR=win['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':re
|
||||
+ ' <a title="Import MathJax?" href="javascript:(function(){ var scriptElMathJax = document.createElement(\'script\'); scriptElMathJax.type = \'text/javascript\'; scriptElMathJax.src = \'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&locale=fr\'; document.head.appendChild(scriptElMathJax); })();" >MathJax?</a>'
|
||||
+ ' <a title="Fetch a beacon image?" href="javascript:(function(){ var linkEl = document.createElement(\'img\'); linkEl.alt = \'GA|Analytics\'; linkEl.style = \'visibility: hidden; display: none;\'; linkEl.src = \'http://perso.crans.org/besson/beacon/14/navbar/strapdown.js?pixel\'; document.body.appendChild(linkEl); })();">Beacon?</a>' // https://ga-beacon.appspot.com/UA-38514290-14/
|
||||
+ '</div> </div> </div>';
|
||||
document.body.insertBefore(newNode, document.body.firstChild);
|
||||
if (!(queryOrigin['nonnavbar'])) {
|
||||
document.body.insertBefore(newNode, document.body.firstChild);
|
||||
}
|
||||
var title = titleEl.innerHTML;
|
||||
var headlineEl = document.getElementById('headline');
|
||||
if (headlineEl)
|
||||
|
2
strapdown.min.js
vendored
2
strapdown.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -2057,10 +2057,12 @@ var prettyPrint;
|
||||
}
|
||||
if (!u && a) {
|
||||
/** @type {string} */
|
||||
newNode.innerHTML = '<div class="navbar-inner"> <div class="container"> <div id="headline" class="brand"> </div> ' + '<div id="headline-copyrights" class="brand">(' + '<a title="http://lbo.k.vu/md" href="http://lbesson.bitbucket.org/md/index.html?src=strapdown.js">StrapDown.js</a> v0.7, ' + 'theme <a title="More information on this theme on bootswatch.com!" href="http://bootswatch.com/' + name + '">' + name + "</a>, " + 'thanks to <a href="https://bitbucket.org/">BitBucket</a>)</div> ' +
|
||||
newNode.innerHTML = '<div class="navbar-inner"> <div class="container"> <div id="headline" class="brand"> </div> ' + '<div id="headline-copyrights" class="brand">(' + '<a title="http://lbo.k.vu/md" href="http://lbesson.bitbucket.org/md/index.html?src=strapdown.js">StrapDown.js</a> v0.8, ' + 'theme <a title="More information on this theme on bootswatch.com!" href="http://bootswatch.com/' + name + '">' + name + "</a>, " + 'thanks to <a href="https://bitbucket.org/">BitBucket</a>)</div> ' +
|
||||
'<div id="headline-squirt" class="brand"> <a title="Quick reader script! Check http://lbesson.bitbucket.org/squirt/ for more details" ' + "href=\"javascript:(function(){sq=window.sq;if(sq&&sq.closed){window.sq.closed&&window.document.dispatchEvent(new Event('squirt.again'));}else{sq=window.sq||{};sq.version='0.4';sq.host='http://lbesson.bitbucket.org/squirt';sq.j=document.createElement('script');sq.j.src=sq.host+'/squirt.js?src=strapdown.js';document.body.appendChild(sq.j);}})();\" " + ">SquirtFR?</a>" + " <a title=\"Import MathJax?\" href=\"javascript:(function(){ var scriptElMathJax = document.createElement('script'); scriptElMathJax.type = 'text/javascript'; scriptElMathJax.src = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&locale=fr'; document.head.appendChild(scriptElMathJax); })();\" >MathJax?</a>" +
|
||||
" <a title=\"Fetch a beacon image?\" href=\"javascript:(function(){ var linkEl = document.createElement('img'); linkEl.alt = 'GA|Analytics'; linkEl.style = 'visibility: hidden; display: none;'; linkEl.src = 'http://perso.crans.org/besson/beacon/14/navbar/strapdown.js?pixel'; document.body.appendChild(linkEl); })();\">Beacon?</a>" + "</div> </div> </div>";
|
||||
document.body.insertBefore(newNode, document.body.firstChild);
|
||||
if (!(fmt["nonavbarfixed"])) {
|
||||
document.body.insertBefore(newNode, document.body.firstChild);
|
||||
}
|
||||
var h = a.innerHTML;
|
||||
/** @type {(HTMLElement|null)} */
|
||||
var e = document.getElementById("headline");
|
||||
|
Reference in New Issue
Block a user