Skip to content

Commit

Permalink
【修复】项目标识和推送不包含文件名问题
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ-568 committed Dec 16, 2024
1 parent 9307a08 commit 73fb961
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 73fb961

Please sign in to comment.