最近开始用README.org了,然后我想问一下org-mode如何插入类似以下代码的图片链接:
Markdown代码:
[![Build Status](https://travis-ci.org/re-mx/misc-elisp.svg?branch=master)](https://travis-ci.org/re-mx/misc-elisp)
最近开始用README.org了,然后我想问一下org-mode如何插入类似以下代码的图片链接:
Markdown代码:
[![Build Status](https://travis-ci.org/re-mx/misc-elisp.svg?branch=master)](https://travis-ci.org/re-mx/misc-elisp)
你看看doom-emacs的README就知道了。(我手机没发给你发代码
C-c C-l
可以用 org-insert-link
插入链接。下面是一个例子
[[https://gitter.im/syl20bnr/spacemacs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge][https://badges.gitter.im/Join Chat.svg]]
Github 可以解析。
doom-emiacs也是markdown啊
谢谢…………
插入图片?你竟然没用大名鼎鼎的 org-download?
edit
抱歉,没看清需求,你说的那个只是普通链接而已,github 自动解析
;; 插动图片到org 文件时, 自动将文件放到org下的img/下,并插入[[file:…img/image.jpg]]
;;;###autoload
(defun vmacs-org-insert-image (event)
(interactive "e")
(x-focus-frame nil)
(let* ((payload (car (last event)))
(type (car payload))
(fromname (cadr payload))
(img-regexp "\\(gif\\|png\\|jp[e]?g\\)\\>")
(destname fromname)
img-dir
)
(when (file-exists-p "../img/")
(setq img-dir "../img/"))
(when (file-exists-p "./img/")
(setq img-dir "./img/"))
(when (and (eq 'drag-n-drop (car event))
(eq 'file type)
(string-match img-regexp fromname)
img-dir)
(let ((filebasename (file-name-base (buffer-file-name)) ))
(setq destname (concat img-dir filebasename "-" (format-time-string "%Y-%m-%d-%H-%M-%S") "." (file-name-extension fromname)))
(rename-file fromname destname t))
(goto-char (nth 1 (event-start event)))
(insert (format "[[file:%s]]" (file-relative-name destname (file-name-directory (buffer-file-name))))))))
记错了,lunarymacs的README 是org