Skip to content

Instantly share code, notes, and snippets.

@charlag
Created October 23, 2019 20:01
Show Gist options
  • Save charlag/73e8b81d9962dedb5d7d97774ab7250a to your computer and use it in GitHub Desktop.
Save charlag/73e8b81d9962dedb5d7d97774ab7250a to your computer and use it in GitHub Desktop.
gh-md.el
(defun gh-md ()
"Copy Replace current file's ORG contents replaced
with Github-flavoured ones. Works quite poorly for now."
(interactive)
(let ((real-buffer (current-buffer)))
(with-temp-buffer
(let ((temp-buffer (current-buffer)))
(with-current-buffer real-buffer
(copy-to-buffer temp-buffer (point-min) (point-max))
))
(while (search-forward "*" nil t)
(replace-match " "))
(beginning-of-buffer)
(while (re-search-forward " TODO" nil t)
(replace-match " - [ ]"))
(beginning-of-buffer)
(while (re-search-forward " DONE" nil t)
(replace-match " - [x]"))
(clipboard-kill-ring-save (point-min) (point-max))
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment