Open tktujy opened 6 years ago
没有报什么错码?控制台
控制台的信息是这样的:
Error in event handler for (unknown): TypeError: Cannot read property 'trace' of undefined
at browser.runtime.sendMessage.response (chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/include.preload.js:750:20)
这个错误是 chrome 的插件报的,你可以给个最小配置我测下吗
下面的是我精简后的配置,目前只在win下测试过。
set encoding=utf-8
inoremap jk <ESC>
function DownloadFile(uri, path)
if has('win32')
silent execute '!powershell -command "& {(New-Object System.Net.WebClient).DownloadFile(\""'.a:uri.'\"", \""'.a:path.'\"")}"'
else
silent execute '!curl -fLo '.a:path.' --create-dirs '.a:uri
endif
endfunction
if has('win32')
let g:VIM_HOME = expand('$VIM/vimfiles')
else
let g:VIM_HOME = expand('$HOME/.vim/')
endif
let s:vim_plug_path = g:VIM_HOME.'/autoload/plug.vim'
let s:vim_plugged_path = g:VIM_HOME.'/plugged'
let s:vim_plug_git = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
if !filereadable(s:vim_plug_path)
let s:autoload_dir = g:VIM_HOME.'/autoload'
if !isdirectory(s:autoload_dir)
call mkdir(s:autoload_dir, "p")
endif
call DownloadFile(s:vim_plug_git, s:vim_plug_path)
endif
filetype off
call plug#begin(s:vim_plugged_path)
Plug 'plasticboy/vim-markdown'
Plug 'iamcco/mathjax-support-for-mkdp'
Plug 'iamcco/markdown-preview.vim'
call plug#end()
filetype plugin indent on
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_math = 1
map <silent> <F8> <Plug>MarkdownPreview
map <silent> <F9> <Plug>StopMarkdownPreview
找到问题了,之前的 pr https://github.com/iamcco/markdown-preview.vim/pull/60 更新了 markedjs,然后我给忘了我用的 marked 是修改过的支持 math 的版本,所以更新之后就挂了,我就先回滚
更新测试公式时发现控制台报错:
Failed to load resource: the server responded with a status of 406 (Not Acceptable)
是访问这个地址出的错:
http://127.0.0.1:11563/DIYURL/MathJax.js?RDpcUHJvZ3JhbSBGaWxlcyAoeDg2KVxWaW1cdmltZmlsZXNccGx1Z2dlZFxtYXRoamF4LXN1cHBvcnQtZm9yLW1rZHBcbWF0aGpheC1zdGF0aWNcIcK2aU1hdGhKYXguanM=&config=TeX-AMS-MML_HTMLorMML
上面的地址的base64
解码出来的路径跟我的实际本地路径不一致,解码出来是
D:\Program Files (x86)\Vim\vimfiles\plugged\mathjax-support-for-mkdp\mathjax-static\!¶iMathJax.js
实际本地路径应该是
D:\Program Files (x86)\Vim\vimfiles\plugged\mathjax-support-for-mkdp\mathjax-static\MathJax.js
我也遇到同样的问题,firefox下,MathJax.js路径的base64编码是不对的,但是配置
let g:mkdp_path_to_chrome ='C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
换到chrome下是正常的,相当神奇
无法预览mathjax公式。检查发现g:mathjax_vim_path变量值正常,但是mathjax-static下mathjax相关的js没有加载,浏览代码chrome浏览器在预览链接后面添加的.html没有被处理导致index.js获取路径出错。另外,即使修正出错的路径,mathjax相关js也没被加载,除非在index.js里添加一行loadMathJax()调用。