Click-to-source (reverse search) between HTML preview and .qmd source
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 42/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- rust, typescript, vscode
- Bereich
- developer-experience, tooling, web-dev
Rechercherichtung
Start with the reload script injected by quarto preview, then inspect the quarto-source-map crate and Codebraid Preview as reference points for tracking static Markdown positions. Define a first version for headings, paragraphs, and lists only; done means a preview double-click sends a position over the existing WebSocket and opens the .qmd source in the editor, while computed chunk output remains excluded.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Feature request
Provide click-to-source (a.k.a. reverse search) between the quarto preview HTML output and the .qmd source, similar to the forward/inverse search Overleaf/SyncTeX provide for LaTeX: double-click an element in the preview and jump to the corresponding line in the editor.
This has sort of come up a few times already: #37 (two-way scroll sync), #492 (open source file for the current preview page), and in quarto-cli discussions #2163 and #12927. Opening this as a single, scoped proposal to consolidate those.
Proposed approach
- Inject source-position metadata into rendered HTML block elements (e.g.
data-sourcepos="file:line:col"). - Extend the reload script that
quarto previewalready injects into the page to listen for adblclickand send the captured position back over the existing WebSocket connection. - On the extension side, open the editor at that location —
code --goto file:line:col, or the equivalentvscode://file/...URI, which works the same way for Positron.
On feasibility
Pandoc has a native sourcepos extension that adds data-pos attributes to the AST, but per Pandoc's changelog it's limited to the CommonMark-family readers (commonmark, gfm, commonmark_x), not the extended markdown reader that .qmd uses by default. So I don't think this wouldn't be a matter of flipping an existing flag for the current engine.
That said, the underlying problem, bidirectional scroll sync for Pandoc documents, including non-CommonMark markdown and documents with executed code, seems to me to be already been solved in an adjacent tool: Codebraid Preview. It maintains its own source-position tracking when Pandoc's native sourcepos isn't available, and stays in sync through code execution via Jupyter kernels. Worth a look as a reference implementation maybe?
Also relevant: the newer Rust parser work in quarto-dev/quarto-markdown already has a quarto-source-map crate for byte-range source tracking, currently used for diagnostics. That could plausibly be the right long-term foundation, even though I didn't see it wired into quarto preview yet.
Suggested scope for a first version
Given the complications around chunk-executed output, I'd suggest starting with static Markdown content (headings, paragraphs, lists) and explicitly excluding computed chunk output rather than aiming for full fidelity on dynamic content immediately. That alone would cover most of the "find where I need to edit" workflow.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 665
- Forks
- 69
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 14
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus quarto-dev/quarto
-
vscode
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
quarto-dev/quarto#1227 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug vscode
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
quarto-dev/quarto#1211 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
quarto-dev/quarto#1139 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 90/100
quarto-dev/quarto#1138 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
quarto-dev/quarto#1137 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in quarto-dev/quarto
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
genfeedai/genfeed.ai#11828 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
IbrahimHafez1/loadwise#251 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
erkamyaman/unslop-anything#415 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Yeachan-Heo/oh-my-codex#4278 ·
Maintainer antworten meist innerhalb von 1 Tag
-
admin
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag