From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ULwCLdrux19APQAA0tVLHw (envelope-from ) for ; Wed, 02 Dec 2020 19:45:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6PPcKNrux1/KYQAA1q6Kng (envelope-from ) for ; Wed, 02 Dec 2020 19:45:30 +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 1416F9404C6 for ; Wed, 2 Dec 2020 19:45:29 +0000 (UTC) Received: from localhost ([::1]:33320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkY47-0008BK-Dn for larch@yhetil.org; Wed, 02 Dec 2020 14:45:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkY3Y-00088i-B5 for emacs-orgmode@gnu.org; Wed, 02 Dec 2020 14:44:52 -0500 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:33762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkY3U-0001pP-Kr for emacs-orgmode@gnu.org; Wed, 02 Dec 2020 14:44:52 -0500 Received: by mail-pf1-x431.google.com with SMTP id q10so1922865pfn.0 for ; Wed, 02 Dec 2020 11:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:message-id:date :mime-version; bh=KmUwRiXctrB/UQ7HZHaZ7klq9RXtdysWc7fQJxHzn/Y=; b=qXVf3sdKHA6c5GiNmBr5xVmXHWRneIcmPb/GxWvOXzo8OpmJ/yng5m6qouQ1IwVcyr 8BwRXuLHyirxgLbRS06145GUnqrYZsIEVt02/gfA36L8J/6K0auNxbv1RrXK1b+NR7IN 8MYrEZu18hoiuJuynv1wGjptz3soWitL2mGeK0Y/jS5eZbfglk3psbXLn/GluGFDSGyR sCcv3BMhw4ymt8muiLECNLQAprY9KK/MhS96QOiPtlUITS6XyC44vapuWmM7Usw5ErCe fZHL0TGrboy/t/DCqBJkqY7cCZSpZHJBe9s0P9LZV15E1TLNDX89kjxu5K0NYifYJAxF xkqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:message-id:date:mime-version; bh=KmUwRiXctrB/UQ7HZHaZ7klq9RXtdysWc7fQJxHzn/Y=; b=l+hRpkISSKJr/6YzqKDAMDHVBFnGoUlrFKop7xdOMJxvbvwzGVODgyF+jFQj0GHyLE xHJF5+qE/jUYj7LbASbaf6wvwJ4mOYM6lR4nD+eUiTDADm2+mCfGUK+JZp33DwRWbgUj 5gFYoE27MynwqHLQcWWaSxeZjcdG8FQBtmO8KGFCk1gkPQyuKXNgKFYzPx+kkcUszUpN NoxiHTtLf80TFGVmao4cs0L5gNGS//g2dHnTtykoBFxmMHVvOmKzMpkSrgYc8olOSZ/9 2sadqaTHH/eGhUx5KGfrzMxYS8qkVD+rlncyd39112ngW0JtIN4H2l8iam36JWctETjG UP8w== X-Gm-Message-State: AOAM531ILbvi9k1UJONk9b7lBLkpSoPuqyTCxDgIQe5dCrDv9UgIGfhT ffwiadfYvH5dBRys4KfYP+dv6nspGa4VJQ== X-Google-Smtp-Source: ABdhPJzdykR9T98tvIZvRhoMfS/Hj5Uo30TXd9hrenrRYTCfNkkbjSJIG0uIlgtMRIfJz938EZ2KJQ== X-Received: by 2002:a62:dd4a:0:b029:19d:95d7:fb96 with SMTP id w71-20020a62dd4a0000b029019d95d7fb96mr2837909pff.79.1606938286476; Wed, 02 Dec 2020 11:44:46 -0800 (PST) Received: from tim-desktop (220-235-10-97.dyn.iinet.net.au. [220.235.10.97]) by smtp.gmail.com with ESMTPSA id l23sm477817pgm.22.2020.12.02.11.44.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 11:44:45 -0800 (PST) References: <9aa624fff553d9d140a6d89aab12e21b@isnotmyreal.name> User-agent: mu4e 1.5.7; emacs 27.1.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: Exporting .org to .md for Sourcehut (sr.ht); ox-md not following Markdown spec? In-reply-to: <9aa624fff553d9d140a6d89aab12e21b@isnotmyreal.name> Message-ID: <874kl4j8lx.fsf@gmail.com> Date: Thu, 03 Dec 2020 06:44:42 +1100 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=theophilusx@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.98 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=qXVf3sdK; dmarc=pass (policy=none) header.from=gmail.com; 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: 1416F9404C6 X-Spam-Score: -1.98 X-Migadu-Scanner: ns3122888.ip-94-23-21.eu X-TUID: okAqR5pWObwX TRS-80 writes: > 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 I could be completely wrong here, but I suspect this is a combination of the evolving markdown spec (or more specifically, no one standard spec) and the age of the org mode markdown exporter. This probably highlights the advantages of a standardised spec. One of the challenges with markdown is that there has never been one universally accepted spec. While the situation has consolidated somewhat since markdown first became popular, there is still some variation in implementations and some of the decisions made when the org mode exporter was first implemented may not be as correct/accepted now. It might be worth looking in the archive. I seem to recall other discussions along these lines some months back. My flawed memory seems to recall that it was probably time for org's markdown exporter to be updated to fit with the more 'common' markdown standard, but I don't recall which that was or whether anyone decided to take that responsibility on. Org already has two markdown flavors - 'generic' markdown and github flavoured markdown. Org's current markdown is based on http://daringfireball.net/projects/markdown, which probably varies enough from the one used by sourcehut to cause the problems you are seeing. Unfortunately, this fails to provide a clear path to fix your problem. I guess the 'sane' thing to do would be to look at how the two different specs differ and then decide if that difference can be managed by providing additional customisation options to the existing markdown exporter or whether the differences are sufficient to warrant another completely different markdown exporter along similar lines to the github flavoured markdown (probably also worth checking the differences between sourceht and github as well in case it is closer to what sorcehut expects). -- Tim Cross