Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs navigation #1156

Merged
merged 4 commits into from Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/README.md
@@ -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
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>