|
|
@@ -1,9 +1,7 @@
|
|
|
<!doctype html>
|
|
|
+<markdown-html version="1.4.1" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
|
|
|
+ license="CC BY-SA 4.0 International" />
|
|
|
<html>
|
|
|
-<!-- 作者:PJ568 -->
|
|
|
-<!-- 项目地址:https://github.com/PJ-568/markdown.html/ -->
|
|
|
-<!-- 本项目遵循 CC BY-SA 4.0 International 许可协议 -->
|
|
|
-<!-- v 1.4.0 -->
|
|
|
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
@@ -244,7 +242,7 @@
|
|
|
const firstH1 = document.querySelector('h1');
|
|
|
document.title = firstH1 ? firstH1.textContent : mdPath;
|
|
|
showMarkdownEnded();
|
|
|
- customPushState(window.location.origin + getPath() + '?p=' + mdPath);
|
|
|
+ customPushState(window.location.origin + window.location.pathname + '?p=' + mdPath);
|
|
|
} catch (error) {
|
|
|
handleError(error)
|
|
|
}
|
|
|
@@ -334,7 +332,7 @@
|
|
|
// 覆写 PJAX 处理响应的函数,在内容插入页面之前实现 markdown 的渲染
|
|
|
PJAX._handleResponse = PJAX.handleResponse;
|
|
|
PJAX.handleResponse = async function (responseText, request, href, options) {
|
|
|
- if (request.responseText.startsWith('<!doctype html>\n<html>\n<!-- 作者:PJ568 -->')) {
|
|
|
+ if (request.responseText.startsWith('<!doctype html><markdown-html' || '<!doctype html>\n<markdown-html')) {
|
|
|
await showMarkdown(await decodeMDPath(href));
|
|
|
} else {
|
|
|
PJAX._handleResponse(responseText, request, href, options);
|