Skip to content

Unable to replace {{foo}} in code block #10706

Closed
@Shina-SG

Description

@Shina-SG

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

When using the Replace function for code block, it doesn't replace certain query if it's too much of it. In this example would be {{test}} other should have the same result such as {{user}}, {{apple}}, ... When there are more than 30 {{test}} the Replace function doesn't seems to be working. 20-30 of {{test}} produce random results of success and failing but above 30 seems to always end up in failing.

Way to reproduce the bug:

  1. Create any new doc.
  2. Create a code block.
  3. Enter in 30 of {{test}} in different lines.
  4. Use the Replace function to replace {{test}} into test.

Expected result

30 of {{test}} in the code block should be replaced into 30 of test via Replace function

Screenshot or screen recording presentation

SiYuan_qPIxTu2UoD.mp4

Version environment

- Version: v3.0.4
- Operating System: Windows 11
- Browser (if used):

Log file

Test.zip

I 2024/03/23 11:27:49 working.go:146:
___ ___ ___ ___
/ /\ ___ ___ //\ / /\ //
/ /:/_ / /\ //| \ :\ / /::\ \ :
/ /:/ /\ / /:/ | |:| \ :\ / /:/:\ \ :
/ /:/ /::\ /
/::\ | |:| ___ \ :\ / /://::\ __:
//:/ /:/:\ _/:_ ||:| /
/\ __:\ /
/:/ /:/:\ /_/::::::::
\ :/:/
/:/ \ :/\ //::::\ \ :\ / /:/ \ :/:// \ :~~/
\ ::/ /:/ _::/ ~:\ \ :\ /:/ \ ::/ \ :\ ~~~
_
/ /:/ //:/ \ :\ \ :/:/ \ :\ \ :
/
/:/ _/ _/ \ ::/ \ :\ \ :
_/ _/ _/ _/
I 2024/03/23 11:27:49 runtime.go:74: kernel is booting:
* ver [3.0.4]
* arch [amd64]
* os [Microsoft Windows 11 IoT Enterprise]
* pid [6288]
* runtime mode [prod]
* working directory [C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources]
* read only [false]
* container [std]
* database [ver=20220501]
* workspace directory [C:\Shina\Test]
I 2024/03/23 11:27:49 conf.go:156: initialized language [en_US] based on device locale
I 2024/03/23 11:27:49 runtime.go:123: use network proxy [system]
I 2024/03/23 11:27:49 serve.go:115: kernel [pid=6288] http server [127.0.0.1:62169] is booting
I 2024/03/23 11:27:50 database.go:89: the database structure is changed, rebuilding database...
I 2024/03/23 11:27:50 database.go:109: reinitialized database [C:\Shina\Test\temp\siyuan.db]
I 2024/03/23 11:27:50 conf.go:807: database size [4.1 kB], tree/block count [0/0]
I 2024/03/23 11:27:50 working.go:192: kernel booted
I 2024/03/23 11:27:50 box.go:76: auto stat [trees=0, blocks=0, dataSize=37 kB, assetsSize=0 B]
I 2024/03/23 11:27:50 disk.go:33: disk usage [total=999 GB, used=309 GB, free=690 GB]
I 2024/03/23 11:27:50 index.go:197: rebuilt database for notebook [20210808180117-6v0mkxr] in [0.01s], tree [count=66, size=1.2 MB]
I 2024/03/23 11:27:51 index.go:269: resolved refs [31] in [20ms]
I 2024/03/23 11:27:51 pandoc.go:155: initialized built-in pandoc [ver=3.1.1, bin=C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:27:51 conf.go:1051: pandoc initialized, set pandoc bin to [C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:27:55 index.go:197: rebuilt database for notebook [20240323112755-gowkgwl] in [0.00s], tree [count=0, size=0 B]
I 2024/03/23 11:27:56 index.go:269: resolved refs [31] in [19ms]
W 2024/03/23 11:27:58 blocktree.go:552: save block tree [size=633 kB] to [C:\Shina\Test\temp\blocktree], elapsed [3.73s]
I 2024/03/23 11:31:02 conf.go:547: exiting kernel [force=false, execInstallPkg=0]
I 2024/03/23 11:31:05 conf.go:1041: closed user guide box [20210808180117-6v0mkxr]
I 2024/03/23 11:31:05 database.go:1244: closed database
W 2024/03/23 11:31:08 blocktree.go:552: save block tree [size=877 B] to [C:\Shina\Test\temp\blocktree], elapsed [3.87s]
I 2024/03/23 11:31:08 conf.go:970: cleared workspace temp
I 2024/03/23 11:31:08 sync.go:712: sync websocket closed
I 2024/03/23 11:31:09 conf.go:615: exited kernel
I 2024/03/23 11:31:13 working.go:146:
___ ___ ___ ___
/ /\ ___ ___ //\ / /\ //
/ /:/_ / /\ //| \ :\ / /::\ \ :
/ /:/ /\ / /:/ | |:| \ :\ / /:/:\ \ :
/ /:/ /::\ /
/::\ | |:| ___ \ :\ / /://::\ __:
//:/ /:/:\ _/:_ ||:| /
/\ __:\ /
/:/ /:/:\ /_/::::::::
\ :/:/
/:/ \ :/\ //::::\ \ :\ / /:/ \ :/:// \ :~~/
\ ::/ /:/ _::/ ~:\ \ :\ /:/ \ ::/ \ :\ ~~~
_
/ /:/ //:/ \ :\ \ :/:/ \ :\ \ :
/
/:/ _/ _/ \ ::/ \ :\ \ :
_/ _/ _/ _/
I 2024/03/23 11:31:13 runtime.go:74: kernel is booting:
* ver [3.0.4]
* arch [amd64]
* os [Microsoft Windows 11 IoT Enterprise]
* pid [8756]
* runtime mode [prod]
* working directory [C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources]
* read only [false]
* container [std]
* database [ver=20220501]
* workspace directory [C:\Shina\Test]
I 2024/03/23 11:31:13 runtime.go:123: use network proxy [system]
I 2024/03/23 11:31:13 serve.go:115: kernel [pid=8756] http server [127.0.0.1:62260] is booting
I 2024/03/23 11:31:13 blocktree.go:495: read block tree [877 B] to [C:\Shina\Test\temp\blocktree], elapsed [0.00s]
I 2024/03/23 11:31:13 conf.go:807: database size [7.5 MB], tree/block count [1/3]
I 2024/03/23 11:31:13 working.go:192: kernel booted
I 2024/03/23 11:31:13 pandoc.go:132: built-in pandoc [ver=3.1.1, bin=C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:31:13 conf.go:1051: pandoc initialized, set pandoc bin to [C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:31:13 box.go:76: auto stat [trees=1, blocks=3, dataSize=65 kB, assetsSize=0 B]
I 2024/03/23 11:31:13 disk.go:33: disk usage [total=999 GB, used=309 GB, free=690 GB]
I 2024/03/23 11:40:09 database.go:109: reinitialized database [C:\Shina\Test\temp\siyuan.db]
I 2024/03/23 11:40:09 index.go:197: rebuilt database for notebook [20240323112755-gowkgwl] in [0.00s], tree [count=1, size=889 B]
I 2024/03/23 11:40:10 index.go:269: resolved refs [0] in [0ms]
I 2024/03/23 11:42:18 database.go:109: reinitialized database [C:\Shina\Test\temp\siyuan.db]
I 2024/03/23 11:42:18 index.go:197: rebuilt database for notebook [20240323112755-gowkgwl] in [0.00s], tree [count=1, size=971 B]
I 2024/03/23 11:42:18 index.go:269: resolved refs [0] in [0ms]
I 2024/03/23 11:43:35 conf.go:547: exiting kernel [force=false, execInstallPkg=0]
I 2024/03/23 11:43:35 database.go:1244: closed database
I 2024/03/23 11:43:35 conf.go:970: cleared workspace temp
I 2024/03/23 11:43:36 sync.go:712: sync websocket closed
I 2024/03/23 11:43:36 conf.go:615: exited kernel
I 2024/03/23 11:43:41 working.go:146:
___ ___ ___ ___
/ /\ ___ ___ //\ / /\ //
/ /:/_ / /\ //| \ :\ / /::\ \ :
/ /:/ /\ / /:/ | |:| \ :\ / /:/:\ \ :
/ /:/ /::\ /
/::\ | |:| ___ \ :\ / /://::\ __:
//:/ /:/:\ _/:_ ||:| /
/\ __:\ /
/:/ /:/:\ /_/::::::::
\ :/:/
/:/ \ :/\ //::::\ \ :\ / /:/ \ :/:// \ :~~/
\ ::/ /:/ _::/ ~:\ \ :\ /:/ \ ::/ \ :\ ~~~
_
/ /:/ //:/ \ :\ \ :/:/ \ :\ \ :
/
/:/ _/ _/ \ ::/ \ :\ \ :
_/ _/ _/ _/
I 2024/03/23 11:43:41 runtime.go:74: kernel is booting:
* ver [3.0.4]
* arch [amd64]
* os [Microsoft Windows 11 IoT Enterprise]
* pid [5856]
* runtime mode [prod]
* working directory [C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources]
* read only [false]
* container [std]
* database [ver=20220501]
* workspace directory [C:\Shina\Test]
I 2024/03/23 11:43:41 runtime.go:123: use network proxy [system]
I 2024/03/23 11:43:41 serve.go:115: kernel [pid=5856] http server [127.0.0.1:62385] is booting
I 2024/03/23 11:43:41 blocktree.go:495: read block tree [624 B] to [C:\Shina\Test\temp\blocktree], elapsed [0.00s]
I 2024/03/23 11:43:41 conf.go:807: database size [74 kB], tree/block count [1/3]
I 2024/03/23 11:43:41 working.go:192: kernel booted
I 2024/03/23 11:43:41 pandoc.go:132: built-in pandoc [ver=3.1.1, bin=C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:43:41 conf.go:1051: pandoc initialized, set pandoc bin to [C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:43:42 box.go:76: auto stat [trees=1, blocks=3, dataSize=74 kB, assetsSize=0 B]
I 2024/03/23 11:43:42 disk.go:33: disk usage [total=999 GB, used=309 GB, free=690 GB]
I 2024/03/23 11:45:01 database.go:109: reinitialized database [C:\Shina\Test\temp\siyuan.db]
I 2024/03/23 11:45:01 index.go:197: rebuilt database for notebook [20240323112755-gowkgwl] in [0.00s], tree [count=1, size=971 B]
I 2024/03/23 11:45:01 index.go:269: resolved refs [0] in [0ms]
I 2024/03/23 11:50:58 database.go:109: reinitialized database [C:\Shina\Test\temp\siyuan.db]
I 2024/03/23 11:50:58 index.go:197: rebuilt database for notebook [20240323112755-gowkgwl] in [0.00s], tree [count=1, size=971 B]
I 2024/03/23 11:50:58 index.go:269: resolved refs [0] in [0ms]
I 2024/03/23 11:51:00 conf.go:547: exiting kernel [force=false, execInstallPkg=0]
I 2024/03/23 11:51:01 database.go:1244: closed database
I 2024/03/23 11:51:01 conf.go:970: cleared workspace temp
I 2024/03/23 11:51:01 sync.go:712: sync websocket closed
I 2024/03/23 11:51:02 conf.go:615: exited kernel
I 2024/03/23 11:51:11 working.go:146:
___ ___ ___ ___
/ /\ ___ ___ //\ / /\ //
/ /:/_ / /\ //| \ :\ / /::\ \ :
/ /:/ /\ / /:/ | |:| \ :\ / /:/:\ \ :
/ /:/ /::\ /
/::\ | |:| ___ \ :\ / /://::\ __:
//:/ /:/:\ _/:_ ||:| /
/\ __:\ /
/:/ /:/:\ /_/::::::::
\ :/:/
/:/ \ :/\ //::::\ \ :\ / /:/ \ :/:// \ :~~/
\ ::/ /:/ _::/ ~:\ \ :\ /:/ \ ::/ \ :\ ~~~
_
/ /:/ //:/ \ :\ \ :/:/ \ :\ \ :
/
/:/ _/ _/ \ ::/ \ :\ \ :
_/ _/ _/ _/
I 2024/03/23 11:51:11 runtime.go:74: kernel is booting:
* ver [3.0.4]
* arch [amd64]
* os [Microsoft Windows 11 IoT Enterprise]
* pid [7004]
* runtime mode [prod]
* working directory [C:\Users\Administrator\AppData\Local\Programs\SiYuan\resources]
* read only [false]
* container [std]
* database [ver=20220501]
* workspace directory [C:\Shina\Test]
I 2024/03/23 11:51:11 runtime.go:123: use network proxy [system]
I 2024/03/23 11:51:11 serve.go:115: kernel [pid=7004] http server [127.0.0.1:62489] is booting
I 2024/03/23 11:51:11 blocktree.go:495: read block tree [624 B] to [C:\Shina\Test\temp\blocktree], elapsed [0.00s]
I 2024/03/23 11:51:11 conf.go:807: database size [74 kB], tree/block count [1/3]
I 2024/03/23 11:51:11 working.go:192: kernel booted
I 2024/03/23 11:51:11 pandoc.go:132: built-in pandoc [ver=3.1.1, bin=C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:51:11 conf.go:1051: pandoc initialized, set pandoc bin to [C:\Shina\Test\temp\pandoc\bin\pandoc.exe]
I 2024/03/23 11:51:11 box.go:76: auto stat [trees=1, blocks=3, dataSize=73 kB, assetsSize=0 B]
I 2024/03/23 11:51:11 disk.go:33: disk usage [total=999 GB, used=309 GB, free=690 GB]
I 2024/03/23 11:51:33 conf.go:547: exiting kernel [force=false, execInstallPkg=0]
I 2024/03/23 11:51:35 database.go:1244: closed database
I 2024/03/23 11:51:35 conf.go:970: cleared workspace temp
I 2024/03/23 11:51:35 sync.go:712: sync websocket closed
I 2024/03/23 11:51:36 conf.go:615: exited kernel

More information

No response

Activity

added this to the 3.0.5 milestone on Mar 24, 2024
changed the title [-]Unable to replace `{{test}}` in code block[/-] [+]Unable to replace `{{foo}}` in code block[/+] on Mar 24, 2024
assigned and unassigned on Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@Vanessa219@Shina-SG

      Issue actions

        Unable to replace `{{foo}}` in code block · Issue #10706 · siyuan-note/siyuan