index.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>Marked.js Documentation</title>
  6. <style>
  7. body {
  8. font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
  9. font-size: 16px;
  10. line-height: 1.5;
  11. word-wrap: break-word;
  12. background: #F9F9F9;
  13. }
  14. #container {
  15. max-width: 900px;
  16. margin: auto;
  17. }
  18. #content {
  19. padding: 5px 10px;
  20. border: 1px solid #ddd;
  21. border-radius: 3px;
  22. background: white;
  23. }
  24. #content h1:first-child {
  25. margin-top: 0px;
  26. }
  27. nav {
  28. border: 1px solid #ddd;
  29. border-radius: 3px;
  30. background: white;
  31. margin-right: 10px;
  32. }
  33. nav > ul {
  34. position: sticky;
  35. top: 5px;
  36. margin: 10px 0px;
  37. padding: 0;
  38. list-style-type: none;
  39. font-size: 14px;
  40. }
  41. nav > ul > li {
  42. min-width: 125px;
  43. padding: 0px 15px;
  44. }
  45. nav > ul > li > ul {
  46. padding-left: 25px;
  47. }
  48. nav > ul > li > ul > li {
  49. font-size: 0.8em;
  50. }
  51. nav .selected {
  52. color: #111;
  53. font-weight: bold;
  54. }
  55. nav .selected:hover {
  56. text-decoration: none;
  57. }
  58. header {
  59. display: flex;
  60. height: 50px;
  61. }
  62. header h1 { margin: 0; }
  63. table {
  64. border-spacing: 0;
  65. border-collapse: collapse;
  66. border: 1px solid #ddd;
  67. }
  68. td, th {
  69. border: 1px solid #ddd;
  70. padding: 5px;
  71. }
  72. a {
  73. color: #0366d6;
  74. text-decoration: none;
  75. }
  76. a:hover {
  77. text-decoration: underline;
  78. }
  79. pre {
  80. font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
  81. padding: 16px;
  82. overflow: auto;
  83. font-size: 85%;
  84. line-height: 1.45;
  85. background-color: #f6f8fa;
  86. border-radius: 3px;
  87. }
  88. code:not([class]) {
  89. padding: 0.2em 0.4em;
  90. margin: 0;
  91. font-size: 85%;
  92. background-color: rgba(27,31,35,0.05);
  93. border-radius: 3px;
  94. }
  95. .github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
  96. </style>
  97. </head>
  98. <body>
  99. <a href="https://github.com/markedjs/marked" class="github-corner" aria-label="View source on Github">
  100. <svg width="80" height="80" viewBox="0 0 250 250" style="fill:#202020; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
  101. <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
  102. <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
  103. <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
  104. </svg>
  105. </a>
  106. <div id="container">
  107. <header>
  108. <a href="#/README.md">
  109. <img src="img/logo-black.svg" height="64px" width="64px" />
  110. </a>
  111. <h1>Marked.js Documentation</h1>
  112. </header>
  113. <div style="display: flex">
  114. <nav>
  115. <ul>
  116. <li>
  117. <a href="#/README.md">Getting Started</a>
  118. <ul>
  119. <li><a href="#/README.md#demo">Demo</a></li>
  120. <li><a href="#/README.md#installation">Installation</a></li>
  121. <li><a href="#/README.md#usage">Usage</a></li>
  122. <li><a href="#/README.md#specifications">Specs</a></li>
  123. <li><a href="#/README.md#security">Security</a></li>
  124. </ul>
  125. </li>
  126. <li>
  127. <a href="#/USING_ADVANCED.md">Advanced Usage</a>
  128. <ul>
  129. <li><a href="#/USING_ADVANCED.md#options">Options</a></li>
  130. <li><a href="#/USING_ADVANCED.md#highlight">Highlighting</a></li>
  131. <li><a href="#/USING_ADVANCED.md#workers">Workers</a></li>
  132. </ul>
  133. </li>
  134. <li>
  135. <a href="#/USING_PRO.md">Extensibility</a>
  136. <ul>
  137. <li><a href="#/USING_PRO.md#use">marked.use()</a></li>
  138. <li><a href="#/USING_PRO.md#renderer">Renderer</a></li>
  139. <li><a href="#/USING_PRO.md#tokenizer">Tokenizer</a></li>
  140. <li><a href="#/USING_PRO.md#walk-tokens">Walk Tokens</a></li>
  141. <li><a href="#/USING_PRO.md#lexer">Lexer</a></li>
  142. <li><a href="#/USING_PRO.md#parser">Parser</a></li>
  143. </ul>
  144. </li>
  145. <li>
  146. <a href="#/CONTRIBUTING.md">Contributing</a>
  147. <ul>
  148. <li><a href="#/CONTRIBUTING.md#design-principles">Design Principles</a></li>
  149. <li><a href="#/CONTRIBUTING.md#priorities">Priorities</a></li>
  150. <li><a href="#/CONTRIBUTING.md#test-early-often-and-everything">Testing</a></li>
  151. </ul>
  152. </li>
  153. <li><a href="#/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
  154. <li><a href="#/AUTHORS.md">Authors</a></li>
  155. <li><a href="#/PUBLISHING.md">Publishing</a></li>
  156. <li><a href="https://github.com/markedjs/marked/blob/master/LICENSE.md">License</a></li>
  157. </ul>
  158. </nav>
  159. <div id="content"></div>
  160. </div>
  161. </div>
  162. <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  163. <script src="https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js"></script>
  164. <script src="https://cdn.jsdelivr.net/npm/unfetch/dist/unfetch.umd.js"></script>
  165. <script>
  166. if (!window.Promise) {
  167. window.Promise = ES6Promise;
  168. }
  169. if (!window.fetch) {
  170. window.fetch = unfetch;
  171. }
  172. var content = document.querySelector('#content');
  173. var body = document.querySelector('html');
  174. var navLinks = document.querySelectorAll('nav a');
  175. var currentPage = 'README.md';
  176. var currentHash = '';
  177. var renderedPage = '';
  178. function hashChange() {
  179. var hash = location.hash.slice(1);
  180. if (!hash) {
  181. hash = 'README.md';
  182. }
  183. var uri = hash.split('#');
  184. if (uri[0].match(/^\//)) {
  185. currentPage = uri[0].slice(1);
  186. if (uri.length > 1) {
  187. currentHash = uri[1];
  188. } else {
  189. currentHash = '';
  190. }
  191. } else {
  192. currentHash = uri[0];
  193. }
  194. fetchPage(currentPage).then(function () {
  195. fetchAnchor(currentHash)
  196. });
  197. var url = '#/' + currentPage + (currentHash ? '#' + currentHash : '');
  198. var fullUrl = window.location.origin + '/' + url;
  199. navLinks.forEach(function(link) {
  200. link.className = link.href === fullUrl ? 'selected' : '';
  201. });
  202. history.replaceState('', document.title, url);
  203. }
  204. function fetchAnchor(anchor) {
  205. if (!anchor) {
  206. return;
  207. }
  208. var hashElement = document.getElementById(anchor);
  209. if (hashElement) {
  210. hashElement.scrollIntoView();
  211. }
  212. }
  213. function fetchPage(page) {
  214. if (page === renderedPage) {
  215. return Promise.resolve();
  216. }
  217. return fetch(page)
  218. .then(function (res) {
  219. if (!res.ok) {
  220. throw new Error('Error ' + res.status + ': ' + res.statusText);
  221. }
  222. return res.text();
  223. })
  224. .then(function (text) {
  225. renderedPage = page;
  226. content.innerHTML = marked(text);
  227. body.scrollTop = 0;
  228. }).catch(function (e) {
  229. content.innerHTML = '<p>Oops! There was a problem rendering the page.</p>'
  230. + '<p>' + e.message + '</p>';
  231. });
  232. }
  233. window.addEventListener('hashchange', function (e) {
  234. e.preventDefault();
  235. hashChange();
  236. });
  237. hashChange();
  238. </script>
  239. </body>
  240. </html>