Skip to content

Commit

Permalink
Merge pull request #1156 from UziTech/docs-navigation
Browse files Browse the repository at this point in the history
Docs navigation
  • Loading branch information
styfle authored Mar 25, 2018
2 parents f29bceb + 9c01b83 commit ad6c7f9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
5 changes: 2 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul>
<li><a href="#marked">About</a></li>
<li><a href="#install">Installation</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#specifications">Supported Markdown specifications</a></li>
<li><a href="#security">Security</a></li>
Expand All @@ -11,7 +11,7 @@

<h2 id="marked">Marked</h2>

Marked is
Marked is

1. built for speed.<sup>*</sup>
2. a low-level markdown compiler that allows frequent parsing of large chunks of markdown without caching or blocking for long periods of time.<sup>**</sup>
Expand Down Expand Up @@ -96,4 +96,3 @@ For list of credited authors and contributors, please see our [authors page](AUT
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)

See [license](https://github.com/markedjs/marked/blob/master/LICENSE.md) for more details.

29 changes: 22 additions & 7 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

#container {
position: relative;
max-width: 800px;
margin: auto;
padding: 10px;
Expand Down Expand Up @@ -60,15 +61,28 @@
background-color: rgba(27,31,35,0.05);
border-radius: 3px;
}

.github-ribbon {
position: absolute;
top: 0;
right: 0;
border: 0;
}
</style>
</head>
<body>
<div id="container">
<header>
<img src="img/logo-black.svg" height="64px" width="64px" />
<a href="README.md">
<img src="img/logo-black.svg" height="64px" width="64px" />
</a>
<h1>Marked.js Documentation</h1>
</header>


<a href="https://github.com/markedjs/marked">
<img class="github-ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
</a>

<div id="content"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
Expand All @@ -78,14 +92,15 @@ <h1>Marked.js Documentation</h1>
var content = document.querySelector('#content');
var body = document.querySelector('html');

content.addEventListener('click', function (e) {
var a = e.target;
if (a.tagName.toLowerCase() === 'a' && a.href.indexOf(location.origin) === 0) {
body.addEventListener('click', function (e) {
var a = e.target.closest('a');
if (a && a.href.indexOf(location.origin) === 0) {
var page = a.href.slice(location.origin.length + location.pathname.length);
if (page.slice(-3) === '.md') {
e.preventDefault();
fetchPage(page);
}
history.replaceState("", document.title, "/");
}
}, false);

Expand All @@ -100,8 +115,8 @@ <h1>Marked.js Documentation</h1>
+ '<p>' + e.message + '</p>';
});
}

fetchPage('README.md');
</script>
</body>
</html>
</html>

0 comments on commit ad6c7f9

Please sign in to comment.