-
Notifications
You must be signed in to change notification settings - Fork 9
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
支持外链转换 #790
Labels
enhancement
New feature or request
Comments
注意:必须设置->导出->引用->锚文本块链。 |
const text = `
哈哈哈哈
看看[[001.测试正式文章1](siyuan://blocks/20231028124327-so12rua)](siyuan://blocks/20231028124327-so12rua)
[[001.测试正式文章1](siyuan://blocks/20231028124327-so12rua)](siyuan://blocks/20231028124327-so12rua)
[[001.测试正式文章1](siyuan://blocks/20231028124327-so12rua)](siyuan://blocks/20231028124327-so12rua)
[[测试无数字](siyuan://blocks/20231028124327-so12rua)](siyuan://blocks/20231028124327-so12rua)
`;
const regex = /\[(\d+\..*?|\D+?)\]\(siyuan:\/\/blocks\/(\d+-\w+)\)/g;
const replacedText = text.replace(regex, (match, title, id) => {
const processedTitle = title.replace(/^\d+\./, ''); // 去除数字和点
return `[${processedTitle}](/post/${id}.html)`;
});
console.log(replacedText); |
外链平台测试
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: