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

Quarto Visual Editor support for reference links #42

Closed
reagle opened this issue Dec 16, 2022 · 13 comments
Closed

Quarto Visual Editor support for reference links #42

reagle opened this issue Dec 16, 2022 · 13 comments

Comments

@reagle
Copy link

reagle commented Dec 16, 2022

I'm eagerly awaiting Quarto's stand-alone markdown editor (is there a timeframe on that?) because in my quick test, RStudio's visual mode, is an excellent markdown editor: it supports multiline tables and div sections! Aside from not needing all the R stuff, the show-stopper, though, is that it rewrites all of my carefully made reference links. Could these be supported?

@jjallaire
Copy link
Contributor

We currently aren't able to support reference links because when Pandoc parses the page they are all resolved into "real" links (i.e. the Pandoc AST doesn't have the concept of a reference link, and since our editor is really editing the AST not the markdown text, there isn't any way for us to read or write them).

I'm going to close this issue for now b/c there isn't a way for us to resolve it. Rest assured though if at some point we do get Pandoc AST support for reference links we will implement this in the visual editor!

We do now have a version of the Quarto Visual Editor available in our VS Code extension. Details are here: https://quarto.org/docs/visual-editor/vscode/

@reagle
Copy link
Author

reagle commented Feb 8, 2023

Hi @jjallaire, okay, I'll investigate/raise this issue with pandoc. Did I misunderstand that there will be a stand alone editor or is there a VSC extension only?

@jjallaire
Copy link
Contributor

There will also be a stand alone editor (sometime later this year)

@reagle
Copy link
Author

reagle commented Feb 8, 2023

Do you not support reference links at all? There's a couple of variations and @jgm confirmed pandoc AST doesn't preserve the label, but perhaps you could rewrite with option 1 or 3?

  1. reference link shortcut version
  2. reference link with label
  3. reference link with implicit label

@jjallaire
Copy link
Contributor

Pandoc itself is doing the writing (we don't do raw text transformations ourselves). The problem is that we don't have a way of saying to Pandoc "please write this as a reference link" (at least that I know of). Even if we did they wouldn't round-trip back into the AST.

Very open to any path you can lead us to get this working (definitely could be missing something).

@reagle
Copy link
Author

reagle commented Feb 8, 2023

That option is available on the command line and implicit reference links seem to survive round trips

pandoc --from markdown --to markdown --wrap=preserve --reference-links oc-syllabus-SP.md > out.md

@jgm
Copy link

jgm commented Feb 8, 2023

To clarify: pandoc will allow you to render ALL the links as reference links. But you can't pick and choose.

@reagle
Copy link
Author

reagle commented Feb 8, 2023

Even if all links are made reference links, I think that makes for much more (human) readable and editable markdown.

@jjallaire
Copy link
Contributor

I just test drove this locally and sure enough it does round-trip! We could provide an option similarly to what we currently do for where to write footnotes and how to handle line breaks. I'll re-open this and we'll hopefully work on this very soon!

@jjallaire jjallaire reopened this Feb 8, 2023
@reagle
Copy link
Author

reagle commented Feb 9, 2023

@jjallaire, great, thank you. FYI: here's the markdown, a syllabus, that I tested your editor on. Perhaps it, or other examples I'm happy to share, would be good tests for ensuring whatever you save remains as human legible/editable as possible.

For example, one other nuisance when I go from md2md with pandoc is HTML comments become quoted and labeled. I haven't figured out how to disable that yet, but it means to uncomment something I have to manually select and edit the text rather than using the "uncomment" keyboard shortcut in my editor.

```{=html}
<!-- TODO: this day should be one week after persuasion assignment -->
```

@jgm
Copy link

jgm commented Feb 9, 2023

Disable the raw_attribute extension in pandoc and you won't get this output.

@reagle
Copy link
Author

reagle commented Feb 9, 2023

Thanks, that's:

pandoc --from markdown --to markdown-raw_attribute --wrap=preserve --reference-links

@jjallaire
Copy link
Contributor

Support for writing reference links has been added here: 8db11d6

This is available in v1.64.0 of the VS Code extension (docs here: https://quarto.org/docs/visual-editor/vscode/#links)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants