Code Monkey home page Code Monkey logo

myst-vs-code's People

Contributors

chrisjsewell avatar tavin avatar tfiers avatar wlach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

myst-vs-code's Issues

Add reference syntax highlighting grammar

Myst is designed to be CommonMark compliant, therefore standard Markdown syntax highlighters will work with Myst and handle the common syntaxes. However, it would be desired to have an 'extended' syntax highlighter, to cover the additional syntax introduced by Myst.

The de facto standard for syntax grammar is the TextMate grammar file, with support in Eclipse, Atom, VSCode, Sublime, etc (jupyterlab/jupyterlab#5504 also discusses their potential incorporation). Therefore, it would be good to have a reference implementation (tested somehow?) in this package.

Here are some helpful links:

Unpin testing from VS Code 1.47.0

In #27 tests were pinned to this version, since there was failures using the latest version.

I should:

  • find the newest version that does still and at least update to that,
  • work out what the actual issue is with the newest version
  • think of the best way to pin to a vscode version, but also point out when this is getting old. Or maybe something like running for a pinned version and runnning for the latest version (but allowing this to fail)

Math directive does not render in preview

Describe the bug

The equations in a math directive do not render, whereas inline and math blocks do.

To Reproduce
Type:

f(x)=1

The result is
image

Expected behavior
To render as the following does:
$$
f(x)=1
$$
image

Desktop (please complete the following information):

  • OS: macOS Monterey 12.6 (21G115)
  • VSCode: 1.75.0 (Universal)
  • MyST-Markdown extension: v0.11.0

autocomplete references

I am considering to port a long lecture note (about astronomical data reduction coding) in LaTeX to jupyter book using myst.
I have many places where I have to use {numref}`fig-figurename`, but many times I don't remember fig-figurename for hundreds of figures.
So, the feature I'd love is the autocompletion of references.

Refresh package

Originally posted by @chrisjsewell in #18 (comment)

Thanks @CodeCox.
I have to say, I have not touched this project in months (although I do use it daily within VS Code for the syntax highlighting).

Since then, there has been many, many changes to myst; notably (since vs-code uses markdown-it) the creation of markdown-it-py as the backend to myst-parser, the addition of extended support for a number of markdown-it plugins, and the creation of markdown-it-myst.

I hope to circle back around to this project then (when time permits!), to re-appraise it and integrate all these new developments in.

Ling story short, this should fix the bug!

insider vscode?

I am super excited to give this a try :-)

however, vscode tells me I can't install it because I'm running the insider version of it. Is it trivial to support insider versions? (I'm in 1.38-insider), or do you recommend I move to the stable branch?

(I think it's fine for me to move to stable if that's the best option, I had switched to insider a few months back because of some improvements in their remote server plugin, but I think those are in stable now)

Preview for code-block directive

The preview for the code-block directive needs some improvements. Currently, the pdf output looks quite different:

image

No caption is shown. No line numbers are shown. No lines are highlighted.

Add more directives

Markdown in directives/blocks like {margin} and {admonition} does not get rendered

Would it be sufficient to add |margin|admonition in this line in the syntax file?

VSCode Markdown Preview Enhancement: MyST enhancements are not rendering as expected

The Markdown Preview is not correctly rendering the MyST enhancements.
The following enhanced markdown is ignored and only the content is rendered as plain text.

```{tip}
this is a MyST tip that fails!
```

The MyST-Markdown extension is enabled since highlighting, intellisense, etc works on the enhanced MyST. However it seems that the enhanced Preview part is either not working or not activated. None of the enhanced MyST markup is previewing as expected. The config setting is ticked and VSCode has been restarted many times. I have even added "myst.preview.enable": true to my settings.json as a hack but with no effect. Also this same file is correctly rendered by jupyter-book (jb build/page ...)

PS. The marketplace advertising blurb of MyST-Markdown shows this feature working but Issue #5 seems related and is still open?

Screenshots

  • Screenshot of Extension config in VSCode:extension
    image

  • Screenshot of Edit and Preview panes in VSCode:
    image

  • Screenshot from browser with MyST rendered as expected
    image

Desktop

  • Windows 10, and Windows 10 with WSL2 Ubuntu
  • VSCode 1.48.2
  • MyST-Markdown v0.10.2

Rendering of sphinx extensions

This may be out of scope of this project or perhaps I am misreading documentation on how to do this, but wanted to check: is it possible for additional installed sphinx extensions to have these rendered?

for example have https://sphinx-panels.readthedocs.io/en/latest/ installed and using "dropdown" directive like below:

image

which currently renders the unknown directive:
image

if this is out of scope with this project, curious how others do local development within vscode to help render extensions like this, only other project seen is like: https://docs.restructuredtext.net/

Add Code Execution capability for MyST

Is your feature request related to a problem? Please describe.
It would be great if we could adapt the code execution for Python chunks using the similar implement as vscode-python. With that extension, you could press Cmd+Enter to run the code within the kernel in the editor. This would give a great level of interactivity while writing in MyST.

Describe the solution you'd like
Add code execution capability to MyST extension.

Describe alternatives you've considered
It may be more desirable to add this directly vscode-python. It currently supports jupyter notebook and python scripts with percent sign code chunk delimiters (%%). perhaps the addition of ```python syntax there would be more applicable.

User reports of Issues using Extension on Linux platform

Describe the bug

@chrisjsewell a few of the quantecon community are reporting issues installing / getting this this extension to work on linux platforms. I will setup a Linux VM to explore the root cause a bit further to make this more useful but thought I would let you know in the meantime.

To Reproduce

Coming

Desktop (please complete the following information):

  • OS: [e.g. iOS] Linux (Arch)

Inline roles in tables break markdown preview

Describe the bug
Inline roles in pipeline tables seem to cause the preview engine to freeze.

To Reproduce

  1. Download this file and remove the .txt extension. (Github wouldn't let me upload a .md file.)
    roles-in-tables-bug.md.txt
  2. Open it in VS Code.
  3. Run the command Markdown: Open Preview to the Side

Expected behavior

The contents of the file should be displayed in a markdown preview on the right side.

Actual behavior:

If the preview has never been loaded for the file, the preview pane remains blank.
If the preview has been loaded previously for the same file, it stops updating the new content.

Screenshots

Here is a screenshot with a table including inline roles, where the preview fails to load.

broken-screenshot

Here is a screenshot of the same file, except without the table that has the inline roles.

working-screenshot

Desktop

  • OS: MacOS 11.2.3 (20D91)
  • VS Code: 1.54.3
  • MyST-Markdown: v0.10.2

Additional context

Here is the log output in the Log (Window).

[2021-04-05 12:31:01.964] [renderer1] [error] Cannot read property 'attrPush' of undefined: TypeError: Cannot read property 'attrPush' of undefined
    at Object.exports.addAttrs (~/.vscode/extensions/jebbs.markdown-extended-1.0.19/node_modules/markdown-it-attrs/utils.js:127:13)
    at Object.transform (~/.vscode/extensions/jebbs.markdown-extended-1.0.19/node_modules/markdown-it-attrs/patterns.js:66:15)
    at Array.curlyAttrs (~/.vscode/extensions/jebbs.markdown-extended-1.0.19/node_modules/markdown-it-attrs/index.js:30:19)
    at a.process (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:142666)
    at h.parse (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:103780)
    at t.MarkdownEngine.tokenizeString (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:97452)
    at t.MarkdownEngine.tokenizeDocument (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:97329)
    at t.MarkdownEngine.parse (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:97850)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at t.default.getRegions (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:62771)
    at async Promise.all (index 0)
    at t.default.provideFoldingRanges (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/extension.js:1:62620)

Look into semantic highlighting

VS Code just introduced this feature, which may be if use?

What is the difference between syntax and semantic highlighting?

Syntax highlighting colors the text based on lexical rules. In VS Code the lexical rules are expressed as regular expressions contained in a TextMate grammar.

Semantic highlighting enriches the syntax coloring based on symbol information from a language service that has the full understanding of the project. Based on this understanding each identifier gets colored & styled with the color of the symbol it resolves to. A constant variable name is rendered as constant throughout the file, not just in its declaration. Same for parameter names, property names, class names and so on.

Add to OpenVSX marketplace

Is your feature request related to a problem? Please describe.
This great extension could/should also be available in Codium (open-source base of VSCode).

Describe the solution you'd like
Sent also versions to OpenVSX marketplace: https://open-vsx.org/

Describe alternatives you've considered

Additional context
VSCode and Codium have separate marketplaces, but extensions can be present on both.

Add syntax highlighting for directives specified using the colon fence

Is your feature request related to a problem? Please describe.
I love how the colon fence plugin renders directives that use it (for example, the note admonition) in previews. I'd like to see the plugin also perform syntax highlighting in the source.

Describe the solution you'd like
When using the colon fence with a directive, I'd like to see the same highlighting I see when I use the backtick or tilde fence. See the attached screenshot.

Describe alternatives you've considered
N/A

Additional context
Screenshot 2023-04-13 at 2 44 16 PM

Markdown Preview is not correctly rendering

The Markdown Preview is not correctly rendering the MyST enhancements.
The following enhanced markdown is ignored and only the content is rendered as plain text.

``` {tip} this is a MyST tip that fails! ```

and

``` {note} this is a MyST tip that fails! ```

The MyST-Markdown extension is enabled since highlighting, intellisense, etc works on the enhanced MyST. However it seems that the enhanced Preview part is either not working or not activated. None of the enhanced MyST markup is previewing as expected.

Desktop:
Windows 11,
VSCodeUserSetup-x64-1.83.1
MyST-Markdown 2.0.0

Can't find the extension in the marketplace

Describe the bug
When I try ext install ExecutableBookProject.myst-highlight in the quick open box, it searches for this name in the marketplace but nothing relevant is found. I tried searching for different parts of the name, but can't find anything that looks like the correct extension. I'm on Linux so possible related to #20? I'm relatively new to VS Code, so it is possible I'm missing something obvious here.

image

Desktop (please complete the following information):

Version: 1.53.2
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T21:13:58.622Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.11.1-arch1-1

Fix directive YAML option blocks

Currently, YAML block are added only for code blocks:

image

As you can see, they work. However, they will currently be matched at any point in the cell:

image

This needs to be fixed, so that they are only matched if they start on the first line. Then they can be rolled out for all directives. I'm not sure what the correct grammar if for this

Myst-vs-code blocks plantuml rendering for code blocks

Describe the bug

With the jebbs.plantuml extension and the VS Code internal Markdown preview,
the following code will produce a rendered inline plantUML diagram inside the markdown preview:

# My diagram document

This should render as an inline diagram in VS code markdown preview:

```{uml}
@startuml
A -> B
B -> A
@enduml
```

With myst markdown extension enabled (and myst.preview.enable enabled), the above code block is instead rendered as some text block hovering on the right side of the document preview.

With the setting myst.preview.enable set to false, plantUML code blocks like above are rendered as diagrams again.

To Reproduce

  1. Install extension jebbs.plantuml
  2. Configure the plantuml rendering mode to "server" ("local" rendering in Markdown preview won't work)
  3. Create a new markdown file with the content given above
  4. Open Markdown preview to the side

Expected behavior

myst-vs-code should probably forward all "sphinx directives code blocks" for which it doesn't have any special handling to the default markdown renderer. Especially for directives uml, plantuml. However, there are other directives like mermaid for which there might be a special rendering in VS Code.

Screenshots

Desktop (please complete the following information):

  • OS: Ubuntu 20.04 Linux
  • VS Code Version v1.75.0
  • Myst markdown v0.11.0

How best to write the extension

Initially the language id was set as myst, i.e. defining it as a whole new language.
However, that means you can't utilise existing markdown tools, such as previewers.

So now the language id is markdown, which means that
the whole syntax highlighting of all markdown files are being overriden.

At least for VS Code (not sure about other editors) there is the alternative to write
injection-grammars, that just to override certain parts of the highlighting.
This probably seems a better way to do it, although you may lose the ability to fully control some aspects of the language.

You can also extend the VS Code Markdown previewer, via markdown-it plugins: https://code.visualstudio.com/api/extension-guides/markdown-extension

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.