Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead
https://Enter-tainer.github.io/typst-preview/
MIT License
444 stars 21 forks source link

Duplicate Code Display Issue in Typst Preview Extension using Algo package #159

Closed vlashada closed 1 year ago

vlashada commented 1 year ago

Describe the bug The code appears multiple times in the Typst preview pane of the VSCode extension.

To Reproduce

  1. Open Typst preview pane in VSCode (1.83.1).
  2. Write or paste code into the editor.
  3. Observe that the code is displayed multiple times in the preview (v0.8.2)

Expected behavior The code should appear only once in the Typst preview pane corresponding to its occurrence in the editor.

Package/Software version:

VSCode version(Help -> About):

Version: 1.83.1
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:57:32.750Z (2 wks ago)
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.0.0

typst-preview extension version: v0.8.2

Additional context



Hello

#code()[
    \`\`\`py
    for i in range(5):
        println("hey")
    \`\`\`
]```

<img width="1168" alt="image" src="https://github.com/Enter-tainer/typst-preview/assets/79418781/5d2497f6-cd78-46df-9acd-f33113126dcc">
Enter-tainer commented 1 year ago

confirmed. reproduce code:

#import "@preview/algo:0.3.3": algo, i, d, comment, code

Hello

#code()[
    ```py
    for i in range(5):
        println("hey")

]

Myriad-Dreamin commented 1 year ago

Okay with typst-ts-cli compile --format svg --format svg_html (svg/html export), so it is likely a bug in incremental svg export or dom updation.

Myriad-Dreamin commented 1 year ago

This is a bug of incorrect reference to clip paths, introduced in recent changes about v0.7.0~v0.8.2.

And I fixed it by in v0.9.0 branch:

https://github.com/Enter-tainer/typst-preview/blob/54cf15e0a1a4fd49dc44c396a730f4d854dc710d/addons/frontend/src/svg-patch.ts#L523