emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: TRS-80 <lists.trs-80@isnotmyreal.name>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Exporting .org to .md for Sourcehut (sr.ht); ox-md not following Markdown spec?
Date: Wed, 02 Dec 2020 15:25:50 -0500	[thread overview]
Message-ID: <97098a4ea3adde3a51cf3683bc26c86c@isnotmyreal.name> (raw)
In-Reply-To: <CAGY83EdqS2aCLJBpKcK+XpVHQFc32w0ODFjPG+1tEQ46qfu87Q@mail.gmail.com>

>> On Wed, Dec 2, 2020 at 7:54 PM TRS-80 <lists.trs-80@isnotmyreal.name>
>> wrote:
>> 
>> Some further digging revealed that the ox-md exporter (which itself
>> is derived from the HTML exporter(?) makes extensive use of the id
>> attribute in links.  And Sourcehut's HTML sanitizer only allows href
>> and title attributes (not id).[1]
>> 
>> [1] https://man.sr.ht/markdown/#post-processing

> On 2020-12-02 14:45, Diego Zamboni wrote:
> 
> (note: Markdown allows embedded HTML, so ox-md's behavior is not
> incorrect)

Right.  However, unless I am missing something, they (Sourcehut) are
passing the HTML through, but their sanitizer is only allowing a subset
of attributes.  Look closely (on the sr.ht Markdown page we both have
now linked) at what attributes are allowed for links:

a: href, title

Only href and title.  No id!

> Note that according to https://man.sr.ht/markdown/#post-processing,
> Sourcehut uses CommonMark, not plain Markdown, so I guess that's why
> it doesn't allow all HTML tags.

Yes, I am aware they use CommonMark.

However it seems to me that CommonMark is just a less ambiguously
defined version of Markdown, designed to address those particular
criticisms of the original.

I don't know if there is anything in CommonMark spec itself that forbids
passing HTML through, and I did not bother to look that up (and thus I
could be wrong) however I think the problem is rather what I already
said above about id attributes being blocked, by Sourcehut particular
HTML sanitizer.

> There seems to be no ox-commonmark (that I could find) but pandoc does
> support it, so you could probably use ox-pandoc
> (https://github.com/kawabata/ox-pandoc) to export your documents in
> CommonMark format.

I did try using command line pandoc, and ran into some problems (which I
outlined already in separate reply to Jean Louis), but maybe I give this
a try, too.  Thanks.

Cheers,
TRS-80


  reply	other threads:[~2020-12-02 20:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 18:52 Exporting .org to .md for Sourcehut (sr.ht); ox-md not following Markdown spec? TRS-80
2020-12-02 19:12 ` Jean Louis
2020-12-02 19:56   ` TRS-80
2020-12-02 21:32     ` TRS-80
2020-12-02 19:44 ` Tim Cross
2020-12-02 20:44   ` TRS-80
2020-12-02 21:59     ` Tim Cross
2020-12-02 23:17       ` TRS-80
2020-12-02 23:36         ` Tim Cross
2020-12-02 19:45 ` Diego Zamboni
2020-12-02 20:25   ` TRS-80 [this message]
2020-12-11 15:53 ` TRS-80

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=97098a4ea3adde3a51cf3683bc26c86c@isnotmyreal.name \
    --to=lists.trs-80@isnotmyreal.name \
    --cc=emacs-orgmode@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).