Fcom
Fcom

Reputation: 423

Markdown plugin for IntelliJ not showing preview

On Windows 10, I'm using IntelliJ version 2022.2.2. I have the bundled Markdown plugin enabled:

plugin

However, when working on a markdown file (.md), the preview is completely gray, as visible on the right side of the following image:

preview

Do you know what can be causing this issue, and how to solve it?

I've tried to disable and enable the plugin again, or to open different markdown files from different IntelliJ projects, but the problem remains the same.

Upvotes: 32

Views: 19972

Answers (13)

Oktay
Oktay

Reputation: 148

On ubuntu 24.10 this helped with a JBR with JCEF Runtime:

https://youtrack.jetbrains.com/issue/JBR-6587/IDEA-crashes-on-opening-a-new-project

Disable this setting from the double shift -> Action-> Registry

ide.browser.jcef.sandbox.enable

Upvotes: 1

Victor S.
Victor S.

Reputation: 2767

File > Invalidate Caches... > Check only Delete embedded browser engine cache and cookies > Invalidate and Restart


Alternatively

  • rm -rfv ~/Library/Caches/JetBrains/PhpStorm*/jcef_cache/Singleton* (MacOS, PhpStorm)
  • Restarting the IDE

The path to the cache files depends on the operating system and IDE, so removal from the UI is universal.

Upvotes: 1

tkonsta
tkonsta

Reputation: 221

To make the Markdown plugin work in a new IntelliJ installation on Ubuntu 24.04 in WSL I needed to install two missing Ubuntu packages using

sudo apt install libnss3-dev libasound2-dev

What helped to figure out which packages are missing was

Then after a restart of IntelliJ everythingw worked as expected

Upvotes: 0

Song
Song

Reputation: 1

I am using Clion2024.2, this works for me:

$ rm -rf ~/.cache/JetBrains/CLion2024.2/jcef_cache/Singleton*

Upvotes: 0

StudioLE
StudioLE

Reputation: 743

There's a far simpler solution:

File > Invalidate Cache

  • Check Clear file system cache and Local History - probably not required

  • Check Clear VCS Log caches and indexes - probably not required

  • Check Delete embedded browser engine cache and cookies - important

  • Press Invalidate and Restart

Upvotes: 4

Volmarg Reiso
Volmarg Reiso

Reputation: 483

I had some popup in bottom-left corner saying

Bla bla Sanbox bla bla

And had button "Disable sandbox".

Clicked it and rendering started working on phpstorm 2024.

Upvotes: -2

Elas
Elas

Reputation: 282

Just setting ide.browser.jcef.gpu.disable=true wasn't enough for me.

I had to also run these commands and then, after restarting IJ, it worked fine.

sudo apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
sudo apt-get install libasound2 

Source

For context, I'm using IntelliJ installed on WSL.

Upvotes: 4

R. Cocinero
R. Cocinero

Reputation: 398

I had this issue in IDEA 2024.1.4, in my case on Ubuntu 22.04. IDEA is installed via snap.

tl;dr

Close IDEA and delete lock files in the chromium profile IDEA's Markdown plugin uses internally, e.g. for IDEA 2024.1:

$ rm -rf ~/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/Singleton*

How I got there + sources

The ide.browser.jcef.gpu.disable=true trick (see CrazyCoder's answer) did not work for me.

While the trick with 'Choose Boot Java Runtime for the IDE' (see rafa's answer) did work for me, the warning there in that selection dialog window made me suspicious of this workaround:

Changing the runtime may cause unexpected problems. Do not change it unless you were specifically asked to do so by JetBrains support.

So, I looked for another solution.

Upon searching how to file a bug report for the bundled Markdown plugin, I found a guide from JetBrains on Reporting JCEF problems. After adding the VM option

-Dide.browser.jcef.log.level=error

as explained there and starting IDEA from the terminal, I noticed ERROR logs containing the following message:

The profile appears to be in use by another Chromium process (18768) on another computer (nb-linux). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.

A process with said ID did not exist, and additionally, my machine has had a different name for a few months now. So I figured it should be safe to unlock said profile – but how, where?

In an unrelated github issue I found mentions of files named Singleton* in Chromium's profile that should be deleted in such cases. As the ERROR logs didn't mention any path or location, I was finally able to find the obscure location of the chromium profile IDEA uses, and the culprit files:

$ find / -name "Singleton*" 2>/dev/null
/home/redacted/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/SingletonSocket
/home/redacted/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/SingletonCookie
/home/redacted/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/SingletonLock

$ ls -l /home/redacted/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/Singleton*
lrwxrwxrwx 1 redacted redacted   20 Apr 22 15:00  SingletonCookie -> 16051078328853667066
lrwxrwxrwx 1 redacted redacted   17 Apr 22 15:00  SingletonLock -> nb-linux-18768
lrwxrwxrwx 1 redacted redacted   50 Apr 22 15:00  SingletonSocket -> /tmp/.org.chromium.Chromium.AbcD1F/SingletonSocket

From that, it was clear that the lock files were about 2.5 months old and obviously not needed. So, I deleted these files (be sure enough that it is really okay to delete them; and better close IDEA before doing so):

$ rm -rf /home/redacted/.cache/JetBrains/IntelliJIdea2024.1/jcef_cache/Singleton*

When starting IDEA afterwards from the terminal, the above ERROR log messages were gone. And the markdown preview was working again.

I hope this helps someone – even if only myself, should I run into this issue again in the future. :)

Upvotes: 24

JojOatXGME
JojOatXGME

Reputation: 3296

Do you have another instance of IDEA running in WSL? In this case, try the following:

  1. Close the other instance of IDEA in WSL

  2. Restart the instance of IDEA which has the blank Markdown preview

Alternatively, for example if you need to keep both instances of IDEA open in parallel, you can change the HTTP port used by IDEA to serve the Markdown preview:

  1. In one of your IDEA instances, go to Help → Edit Custom Properties...

  2. Add the following system property:

    rpc.port=63343
    
  3. Restart IDEA

You may use another port, but it must be a different port in both instance of IDEA. By default, IDEA will use port 63342, and port 64463 in test environments.


I noticed this issue with the ports because my Markdown preview was blank whenever I had another instance of IDEA running inside of WSL. Whenever I started IntelliJ inside WSL before starting another instance of IntelliJ outside of WSL, the IntelliJ outside of WSL only showed blank pages in Markdown previous.

Upvotes: 1

rafa
rafa

Reputation: 81

I tried the above setting the custom properties and it didnt work.

But for me, Help -> Find Action -> Choose Boot Java Runtime for the IDE and selecting the latest version -> Save and restart worked.

Upvotes: 8

Muhammed_G
Muhammed_G

Reputation: 492

After trying to add ide.browser.jcef.gpu.disable=true in Help | Edit Custom Properties and restart the IDE, It did not work for me.

I noticed that I am running Idea application as Administrator every time, so I started the app in normal mode, and worked fine., without any addition in properties.

#Markdown #preview #MD #file #IDEA #IntelliJ

Upvotes: 1

Philippe Cloutier
Philippe Cloutier

Reputation: 599

This is visibly an IntelliJ bug. I am not using Editor and Preview, but I got it on IntelliJ IDEA 2023.1.2 (Community Edition) in Preview mode. Switching to Editor then back to Preview sufficed to workaround.

Upvotes: 3

CrazyCoder
CrazyCoder

Reputation: 402235

Please add ide.browser.jcef.gpu.disable=true in Help | Edit Custom Properties and restart the IDE.

This option disables GPU acceleration for the browser component (JCEF) which seems to fail on your hardware for some reason.

Upvotes: 43

Related Questions