AS修改JCEF Runtime支持Markdown预览

723 阅读1分钟

由于Andriod Studio的Runtime默认阉割了JCEF功能,导致Markdown相关插件无法正常预览。这里介绍怎么通过修改Runtime来支持Markdown的预览。

什么是JCEF?

前提

安装Mardkown语法官方插件 "图片自定义高度" height="" width="" 它默认是支持Markdown的预览,只是Android Studio运行时不支持所以隐藏了相应功能入口。 安装其他第三方的Markdown插件(依赖JCEF进行渲染的)也可以

开启JCEF

第一次选择Runtime时,需要等待一段时间加载可用Runtime列表 "图片自定义高度" height="" width="" 选择支持JCEF的Runtime,确定后会下载Runtime,下载后重启AS。

重启后打开md文件检查是否生效,结果如下: "图片自定义高度" height="" width=""

需知

不能保证支持所有Android Studio版本,修改Runtime可能会影响AS的运行稳定性,但是不会影响应用构建结果

演示环境:

Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 19, 2022
Runtime version: 11.0.13+8-b1504.49 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.4
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Registry: external.system.auto.import.disabled=true, ide.images.show.chessboard=true
Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), ...

恢复默认Runtime "图片自定义高度" height="" width=""