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

Enable Markdown Preview for .rzk.md files #2

Open
fizruk opened this issue May 29, 2023 · 9 comments
Open

Enable Markdown Preview for .rzk.md files #2

fizruk opened this issue May 29, 2023 · 9 comments

Comments

@fizruk
Copy link
Member

fizruk commented May 29, 2023

There is one thing that I don't know yet how to fix: *.md files have Markdown Preview, but *.rzk.md do not anymore. Markdown Preview is useful when I insert SVG diagrams in the markdown files (e.g. see Associativity section for Segal Types). If you have ideas or you would like to submit a PR — it would be most welcome! :)

Originally posted by @fizruk in #1 (comment)

@fredrik-bakke
Copy link
Contributor

Just for input, with Markdown Preview Enhanced this works perfectly fine in my setup. But you said you already tried this without success. Perhaps something can be done with your local setup?

@fizruk
Copy link
Member Author

fizruk commented Jun 11, 2023

Perhaps, although I'm not sure what prevents MPE from working on my machine. The only way I can make it do something is by explicitly calling it from the Palette:

Screenshot 2023-06-11 at 18 05 11

However, I do not get any features like scroll sync:

Screenshot 2023-06-11 at 18 05 56

What do you think I should check locally? I am on a macOS 13.4, VS Code 1.79.0.

@fredrik-bakke
Copy link
Contributor

Oh. I've only used it from the command palette so far, and didn't know about the other features. However, luckily, I think I have a solution for you!
By adding the following to your keybindings.json file. The shortcuts for Markdown Preview Enhanced will work for all file types with markdown in their name :)

{
    "key": "ctrl+shift+enter",
    "command": "markdown-preview-enhanced.runAllCodeChunks",
    "when": "editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "shift+enter",
    "command": "markdown-preview-enhanced.runCodeChunk",
    "when": "editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "ctrl+shift+s",
    "command": "markdown-preview-enhanced.syncPreview",
    "when": "editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "shift+cmd+v",
    "command": "markdown-preview-enhanced.openPreview",
    "when": "editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "cmd+k v",
    "command": "markdown-preview-enhanced.openPreviewToTheSide",
    "when": "editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "shift+cmd+v",
    "command": "markdown.showPreview",
    "when": "!notebookEditorFocused && editorLangId =~ /.*markdown.*/"
  },
  {
    "key": "cmd+k v",
    "command": "markdown.showPreviewToSide",
    "when": "!notebookEditorFocused && editorLangId =~ /.*markdown.*/"
  }

You could ship similar key bindings with the extension if you want, but then I would advise you to only match literate rzk markdown for obvious reasons 😄

@fredrik-bakke
Copy link
Contributor

I'm not getting sync to work either.

@aabounegm
Copy link
Member

Is this resolved by #16 or is there still a missing feature?

@fizruk
Copy link
Member Author

fizruk commented Jun 20, 2023

I think it is good enough, although it would be great to somehow have the option to have Markdown Preview Enhanced to work as well. In particular, MPE allows to sync scrolling code with Markdown and seems to work better with images, etc.

@bragov4ik
Copy link

I'm not sure what is the current status of this feature, but for me sync scrolling works with default markdown preview.
The only small problem I encountered is that the preview can be opened only through a small button on the corner of the editor:
image

I think having a searchable option (command/shortcut) might avoid some confusion with previews.
with rzk file:
image
with md file:
image
image

PR that should fix it:
#37

I got error trying to run it locally, so hopefully someone with environment ready can check if it works 🥺

@aabounegm
Copy link
Member

For what it's worth, scroll sync is working for me with Markdown Preview Enhanced as well. Sadly, I cannot find any resource for having a language (such as literate rzk markdown) inherit another language (markdown in this case) entirely, including its commands and configuration. Only the syntax highlighting as we currently have.

@bragov4ik
Copy link

I'm not sure what is the current status of this feature, but for me sync scrolling works with default markdown preview.

btw sometimes it stops working when file type is literate rzk.... fixable by swtiching it to just markdown file

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

4 participants