emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add markdown support to contrib/org-man export
@ 2020-06-14 20:56 Jb
  2020-06-23  4:05 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Jb @ 2020-06-14 20:56 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

Hey Org-mode enthusiasts,

Find attached a patch adding export of manual links for markdown.

I wanted to get links to man pages to work nicely for my blog 
using ox-hugo, an org exporter based on markdown, built by 
well-known org enthusiast Kaushal Modi.


Org snippet to demonstrate export to markdown feature:

--8<---------------cut here---------------start------------->8---
I sure love [[man:emacs][GNU Emacs]].
--8<---------------cut here---------------end--------------->8---

org-md-export-to-markdown before (link description missing, booh):

--8<---------------cut here---------------start------------->8---
I sure love http://man.he.net/?topic=emacs&section=all.
--8<---------------cut here---------------end--------------->8---

Export to markdown after (pretty, valid markdown, yey):

--8<---------------cut here---------------start------------->8---
I sure love [GNU 
Emacs](http://man.he.net/?topic=emacs&section=all).
--8<---------------cut here---------------end--------------->8---

This is my first contribution (I welcome feedback regarding patch 
formatting etc). No FSF papers due to contrib/.
Happy I can finally contribute /something/ back, and scratching 
that itch feels nice.

Have a fantastic day.

--
Jb


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-contrib-ol-man.el-Add-markdown-support-to-org-man-ex.patch --]
[-- Type: text/x-diff, Size: 799 bytes --]

From c7c2fe978a134347a0b6c30667015c687803eb12 Mon Sep 17 00:00:00 2001
From: Jb DOYON <jb@jiby.tech>
Date: Sun, 14 Jun 2020 21:19:20 +0100
Subject: [PATCH] contrib/ol-man.el: Add markdown support to org-man export

---
 contrib/lisp/ol-man.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/lisp/ol-man.el b/contrib/lisp/ol-man.el
index 580556a..5cb7e01 100644
--- a/contrib/lisp/ol-man.el
+++ b/contrib/lisp/ol-man.el
@@ -68,6 +68,7 @@ PATH should be a topic that can be thrown at the man command."
      ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
      ((eq format 'texinfo) (format "@uref{%s,%s}" path desc))
      ((eq format 'ascii) (format "%s (%s)" desc path))
+     ((eq format 'md) (format "[%s](%s)" desc path))
      (t path))))
 
 (provide 'ol-man)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-23  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 20:56 [PATCH] Add markdown support to contrib/org-man export Jb
2020-06-23  4:05 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).