emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jb <jb@jiby.tech>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Add markdown support to contrib/org-man export
Date: Sun, 14 Jun 2020 21:56:55 +0100	[thread overview]
Message-ID: <87eeqhv014.fsf@jb.jiby.tech> (raw)

[-- 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


             reply	other threads:[~2020-06-15 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 20:56 Jb [this message]
2020-06-23  4:05 ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeqhv014.fsf@jb.jiby.tech \
    --to=jb@jiby.tech \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] Add markdown support to contrib/org-man export' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).