Skip to content

Commit ad6c7f9

Browse files
authored
Merge pull request #1156 from UziTech/docs-navigation
Docs navigation
2 parents f29bceb + 9c01b83 commit ad6c7f9

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

docs/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ul>
22
<li><a href="#marked">About</a></li>
3-
<li><a href="#install">Installation</a></li>
3+
<li><a href="#installation">Installation</a></li>
44
<li><a href="#usage">Usage</a></li>
55
<li><a href="#specifications">Supported Markdown specifications</a></li>
66
<li><a href="#security">Security</a></li>
@@ -11,7 +11,7 @@
1111

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

14-
Marked is
14+
Marked is
1515

1616
1. built for speed.<sup>*</sup>
1717
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>
@@ -96,4 +96,3 @@ For list of credited authors and contributors, please see our [authors page](AUT
9696
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
9797

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

docs/index.html

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
}
1313

1414
#container {
15+
position: relative;
1516
max-width: 800px;
1617
margin: auto;
1718
padding: 10px;
@@ -60,15 +61,28 @@
6061
background-color: rgba(27,31,35,0.05);
6162
border-radius: 3px;
6263
}
64+
65+
.github-ribbon {
66+
position: absolute;
67+
top: 0;
68+
right: 0;
69+
border: 0;
70+
}
6371
</style>
6472
</head>
6573
<body>
6674
<div id="container">
6775
<header>
68-
<img src="img/logo-black.svg" height="64px" width="64px" />
76+
<a href="README.md">
77+
<img src="img/logo-black.svg" height="64px" width="64px" />
78+
</a>
6979
<h1>Marked.js Documentation</h1>
7080
</header>
71-
81+
82+
<a href="https://github.com/markedjs/marked">
83+
<img class="github-ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
84+
</a>
85+
7286
<div id="content"></div>
7387
</div>
7488
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
@@ -78,14 +92,15 @@ <h1>Marked.js Documentation</h1>
7892
var content = document.querySelector('#content');
7993
var body = document.querySelector('html');
8094

81-
content.addEventListener('click', function (e) {
82-
var a = e.target;
83-
if (a.tagName.toLowerCase() === 'a' && a.href.indexOf(location.origin) === 0) {
95+
body.addEventListener('click', function (e) {
96+
var a = e.target.closest('a');
97+
if (a && a.href.indexOf(location.origin) === 0) {
8498
var page = a.href.slice(location.origin.length + location.pathname.length);
8599
if (page.slice(-3) === '.md') {
86100
e.preventDefault();
87101
fetchPage(page);
88102
}
103+
history.replaceState("", document.title, "/");
89104
}
90105
}, false);
91106

@@ -100,8 +115,8 @@ <h1>Marked.js Documentation</h1>
100115
+ '<p>' + e.message + '</p>';
101116
});
102117
}
103-
118+
104119
fetchPage('README.md');
105120
</script>
106121
</body>
107-
</html>
122+
</html>

0 commit comments

Comments
 (0)