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

[BUG] 无法使用 Nunjucks 的正则替换功能 #345

Open
Moyf opened this issue Nov 26, 2024 · 0 comments
Open

[BUG] 无法使用 Nunjucks 的正则替换功能 #345

Moyf opened this issue Nov 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Moyf
Copy link

Moyf commented Nov 26, 2024

**描述bug **

例如:
# {{metaData.title | replace(r/(.*)/, '') }}

Nunjucks在线测试网站中,这样的正则替换语法是可以成功的:
image

包括 Nunjucks 文档中也提及了对正则的支持。

但是在 Weread 插件中如果这样填写,会报错:
image

对应的报错内容:
image

重现步骤
重现错误的步骤:

  1. 在 Nunjucks 模板输入框里粘贴 # {{metaData.title | replace(r/(.*)/, '') }} 即可复现

预期行为
我希望用正则替换去移除微信在书名里强行塞入的广告,类似:
image

但没有正则的话可能无法实现这个……

我甚至希望文件名也能把这个括号内容替换掉,目前我看到的括号里的内容无一例外都是废话

截图
上面已经附上了。

桌面(请填写以下信息):

  • 操作系统: Windows 11
  • Obsidian版本:1.7.7
  • 插件版本: 0.11.2
@Moyf Moyf added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants