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

Fix: iOS < 17 not support look behind #31

Merged
merged 1 commit into from
Oct 25, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@junyiacademy/perseus-core",
"version": "1.0.46",
"version": "1.0.47",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions packages/simple-markdown/src/legacyMarkdownAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export const adaptLegacyMarkdown = (str: string) => {
// heading 前只有一個 \n 時,將 \n 改為 \n\n
const addedNewLineAboveHeadingStr = str.replace(
/(?<=[^\n]\n *)(#{1,6}.*)/g,
"\n$1",
/([^\n]\n *)(#{1,6}.*)/g,
"$1\n$2",
);
// heading 後只有一個 \n 時,將 \n 改為 \n\n
const addedNewLineUnderHeadingStr = addedNewLineAboveHeadingStr.replace(
/(?<=\n *|^)(#{1,6}[^\n]*)(?=\n[^\n])/g,
"$1\n",
/(\n *|^)(#{1,6}[^\n]*)(?=\n[^\n])/g,
"$1$2\n",
);
// hr 後只有一個 \n 時,將 \n 改為 \n\n
const addedNewLineUnderHrStr = addedNewLineUnderHeadingStr.replace(
/(?<=\n *)([-*_]{3,})(?=\n[^\n])/g,
"$1\n",
/(\n *)([-*_]{3,})(?=\n[^\n])/g,
"$1$2\n",
);

return addedNewLineUnderHrStr;
Expand Down