This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Create Markdown Hyperlink Automatically | |
" Requires mattn/webapi-vim (or vital.vim), tpope/vim-surround, | |
" kana/vim-textobj-user, mattn/vim-textobj-url | |
" command! MDURL call CreateMarkdownHyperLink() | |
" command! MDURLTitle call CreateMarkdownHyperLinkWithTitle() | |
function! GetWebPageTitle(url) | |
let url = substitute(a:url,'\n\|\r\|\r\n','','g') | |
let res = webapi#http#get(url) | |
let dom = webapi#html#parse(res.content) | |
return dom.childNode('head').childNode('title').value() |