From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YAJJHUrvx18aOgAA0tVLHw (envelope-from ) for ; Wed, 02 Dec 2020 19:47:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eOoQGUrvx1/LYQAAbx9fmQ (envelope-from ) for ; Wed, 02 Dec 2020 19:47:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 903A594051B for ; Wed, 2 Dec 2020 19:47:21 +0000 (UTC) Received: from localhost ([::1]:35142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkY5w-0000mF-GN for larch@yhetil.org; Wed, 02 Dec 2020 14:47:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkY4g-0000fn-RA for emacs-orgmode@gnu.org; Wed, 02 Dec 2020 14:46:02 -0500 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:39563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkY4d-000243-9w for emacs-orgmode@gnu.org; Wed, 02 Dec 2020 14:46:02 -0500 Received: by mail-ed1-x543.google.com with SMTP id c7so5288303edv.6 for ; Wed, 02 Dec 2020 11:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zzamboni-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cz3gQZTzZKbU4GIBOMNeC1e97pxvhKo0Rv0cL83l1bc=; b=gb9J8vygzIr2P4kkeE1WIbHA7c1uuCNBZeEHneMi7/3QpAn8tg8WtO4Bl1lobd0fLH Ma+95X7v01FAKv6Pw/zMI5K+N6BEVH8/zBDVzfDfaGPhR7xW1niTdhXYjv0jjflQpKIm /J4VLXqQAu30eYnbOuGP6k/1hFLFnAJcdAoLmZPpI5EaYtgD412NaLBGoFcVwjV+yNH1 IZ3cPyBNUmCspshzVYdWTRhD3OHCf/gWkL9naCxDKzI6lRgr35VH2i6JafJIyhSLc4IL GTCcO69QLFtvOajF7MPYJW3lnxuZKYevWdI0rGcFBUN04+NIxo9gzBscZR6dGYtQbpWX zsvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cz3gQZTzZKbU4GIBOMNeC1e97pxvhKo0Rv0cL83l1bc=; b=dlKehj6T4cNm+vPJyg1wNjORdDBzocBoWvGgqGYZXZ1VDKpkyc/EwgspnxynXMjsTU PVFG01CHuB4peOaR/SOPNMRPNXc9IAQwDCspn0YhU/Xugqj7YL5gCnFyxbLsqHNI9mGe C+QOOnuA7WT5QlFOe8ZxZBKf0pmTx2ZGPY7276RH4btnCO+iO8SaOi8dUHLLPW3SQqjW V6u3LHY+zVc6N4aFjVzN2yyPq93EotihkgsDMXQjSeMe7o5Ogv01MpH76UyKzFbFLxiH nIsfnhw85ke2x0dzoA9SiBfP1u5Y5omUrJGAfNx7+HefqGoGPxZ5Vs3IKukRCOCyHK3Z CKsQ== X-Gm-Message-State: AOAM531KfnIeA57J7yYTp081Xn6zODvYKwf1xez1S/S8UEABgLRql/TO A81+52C7QEdSsW4kgeiDtDvmiqkZeQXDquG+Jmesng== X-Google-Smtp-Source: ABdhPJwY0drJkPuajyRgKziakLka0qAw9W3qKU9/4HnTfAEcady6khzERHkHYpsbo6KP6BPuwXMtNV8luNfNT0/He7M= X-Received: by 2002:a50:d5c4:: with SMTP id g4mr1512999edj.334.1606938356388; Wed, 02 Dec 2020 11:45:56 -0800 (PST) MIME-Version: 1.0 References: <9aa624fff553d9d140a6d89aab12e21b@isnotmyreal.name> In-Reply-To: <9aa624fff553d9d140a6d89aab12e21b@isnotmyreal.name> From: Diego Zamboni Date: Wed, 2 Dec 2020 20:45:45 +0100 Message-ID: Subject: Re: Exporting .org to .md for Sourcehut (sr.ht); ox-md not following Markdown spec? To: TRS-80 Content-Type: multipart/alternative; boundary="000000000000e8be1b05b5807d14" Received-SPF: none client-ip=2a00:1450:4864:20::543; envelope-from=diego@zzamboni.org; helo=mail-ed1-x543.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.48 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=zzamboni-org.20150623.gappssmtp.com header.s=20150623 header.b=gb9J8vyg; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 903A594051B X-Spam-Score: -1.48 X-Migadu-Scanner: ns3122888.ip-94-23-21.eu X-TUID: 4NVANH1D+yBY --000000000000e8be1b05b5807d14 Content-Type: text/plain; charset="UTF-8" Hi TRS-80, 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. (note: Markdown allows embedded HTML, so ox-md's behavior is not incorrect) 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. --Diego On Wed, Dec 2, 2020 at 7:54 PM TRS-80 wrote: > Hallo, > > I became quite interested in what Drew Devault was doing with his > Sourcehut project, so I decided to join. I was really enjoying > everything except for the fact that .org files are not supported insofar > as automatic rendering into nice looking HTML in the same way that > Markdown files are for the README at the root of the project. And the > official word is that only Markdown is to be supported.[0] > > So I start digging into this, my first try was to use > org-md-export-to-markdown function to generate the supported Markdown. > However, doing it that way broke all inter-page links (to headings, > footnotes, etc.). > > 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] > > For example, here are the sort of links that the ox-md exporter create: > > ToC: > > ``` > 1. [rofi-in-elisp](#orgdbf2274) > ``` > > Body: > > ``` > > > # rofi-in-elisp > ``` > > Above was copied straight from Eli Schwartz reply to me in my post to > Sourcehut mailing list about this[0] (although I had already noticed the > same thing as well). > > I tend to agree with him that this is not following the Markdown spec, > where links should instead become simply: > > ToC: > > ``` > 1. [rofi-in-elisp](#rofi-in-elisp) > ``` > > And if so, then the Right Thing to do would be to fix that in the ox-md > exporter? > > However OTOH, I can't help but venture a guess that there must have been > some reason to do it that way in the first place. > > So before I invest any more time going down this path, I thought I would > take a step back and seek some advice whether this is actually the > correct path or not? > > Cheers, > TRS-80 > > [0] > > https://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3Cfe7aa296-9c90-463d-b4e6-50eeb7e57428%40localhost%3E > [1] https://man.sr.ht/markdown/#post-processing > > --000000000000e8be1b05b5807d14 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi TRS-80,

Note that according to=C2=A0= https://man.sr.ht/m= arkdown/#post-processing, Sourcehut uses CommonMark, not plain Markdown= , so I guess that's why it doesn't allow all HTML tags.
<= br>
(note: Markdown allows embedded HTML, so ox-md's behavior= is not incorrect)

There seems to be no ox-commonm= ark (that I could find) but pandoc does support it, so you could probably u= se ox-pandoc (https://git= hub.com/kawabata/ox-pandoc) to export your documents in CommonMark form= at.

--Diego


On Wed, Dec 2, 202= 0 at 7:54 PM TRS-80 <li= sts.trs-80@isnotmyreal.name> wrote:
Hallo,

I became quite interested in what Drew Devault was doing with his
Sourcehut project, so I decided to join.=C2=A0 I was really enjoying
everything except for the fact that .org files are not supported insofar as automatic rendering into nice looking HTML in the same way that
Markdown files are for the README at the root of the project.=C2=A0 And the=
official word is that only Markdown is to be supported.[0]

So I start digging into this, my first try was to use
org-md-export-to-markdown function to generate the supported Markdown.
However, doing it that way broke all inter-page links (to headings,
footnotes, etc.).

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.=C2=A0 And Sourcehut's HTML sanitizer only allows hr= ef and
title attributes (not id).[1]

For example, here are the sort of links that the ox-md exporter create:

ToC:

```
1.=C2=A0 [rofi-in-elisp](#orgdbf2274)
```

Body:

```
<a id=3D"orgdbf2274"></a>

# rofi-in-elisp
```

Above was copied straight from Eli Schwartz reply to me in my post to
Sourcehut mailing list about this[0] (although I had already noticed the same thing as well).

I tend to agree with him that this is not following the Markdown spec,
where links should instead become simply:

ToC:

```
1.=C2=A0 [rofi-in-elisp](#rofi-in-elisp)
```

And if so, then the Right Thing to do would be to fix that in the ox-md
exporter?

However OTOH, I can't help but venture a guess that there must have bee= n
some reason to do it that way in the first place.

So before I invest any more time going down this path, I thought I would take a step back and seek some advice whether this is actually the
correct path or not?

Cheers,
TRS-80

[0]
ht= tps://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3Cfe7aa296-9c90-463d-b4e6-50eeb7= e57428%40localhost%3E
[1] https://man.sr.ht/markdown/#post-processing

--000000000000e8be1b05b5807d14--