vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
815 stars 127 forks source link

Typescript code block not rendered correctly #765

Closed arturhun closed 4 years ago

arturhun commented 5 years ago

Both variants not satisfying my eyes :) Could we have it improved please?

image

image

vsch commented 5 years ago

@arturhun, depending on whether you have HighlightJS or Prism selected as your syntax highlighter script this will change.

The selection is made in Stylesheet-Settings

The two scripts use different style sheets and can be customized by modifying CSS for individual elements or as a whole: Customizing-HTML-Preview

arturhun commented 5 years ago

Why would all the Scripts be disabled/greyed out?

vsch commented 5 years ago

@arturhun, the syntax highlighting scripts are available only in JavaFX preview browser.

ℹ️ The syntax highlighting in the text editor injected language is controlled by the settings for the language and not markdown, just like injected language in Java strings.

The typescript highlighting can be changed under Editor > Color Scheme > TypeScript.

The ts language is not recognized as any language so there is no highlighting.

arturhun commented 5 years ago

@vsch

OK, let's put aside ts - let's talk typescript then.

Not sure I understand what happens - my main framework and language has long been Angular/TypeScript - I would have probably gone crazy if my TS interfaces had the highlighting wrong, marking half of it red as in the first example. :)

I got my TS scheme set like so:

image

So something is screwing the types coloring for markdown.

vsch commented 5 years ago

@arturhun, I am not familiar with typescript but it seems you need some imports to define the types. The injected fragment is parsed by the IDE as is so any undefined types would be highlighted as red.

To confirm you can create a typescript file with the same content as your fenced code to see if it also highlights the types as error.

This is a limitation of the way the IDE syntax highlights injected languages.

arturhun commented 5 years ago

To confirm you can create a typescript file with the same content as your fenced code to see if it also highlights the types as error.

This is exactly why I rasie the problem - pasted existing TS code, formatted just fine, and saw it mangled in markdown. Types like string or number are basic, provided by the language service, not imported.

OK, looks like I will have to live with that. Thanks.

vsch commented 5 years ago

@arturhun, then there is something about injected language processing by typescript plugin that is missing which is included if the code comes from a typescript file.

I will look into it to see if there is an issue with either markdown or typescript plugin that should be addressed.

vsch commented 5 years ago

@arturhun, I don't use typescript so don't know what configuration would affect the error highlighting.

Without changing WebStorm 2019.2 defaults for typescript, I created a typescript file and a markdown file with fenced code. No issues with error highlighting:

image

Anything other than editor colors that is changed from defaults for typescript in your project?