From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gHFeIx7PQGG6EQAAgWs5BA (envelope-from ) for ; Tue, 14 Sep 2021 18:34:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wLryHh7PQGHldwAAB5/wlQ (envelope-from ) for ; Tue, 14 Sep 2021 16:34:38 +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 B5683EB1A for ; Tue, 14 Sep 2021 18:34:37 +0200 (CEST) Received: from localhost ([::1]:36300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQBOG-0005bZ-3A for larch@yhetil.org; Tue, 14 Sep 2021 12:34:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQBNd-0005Xr-QL for emacs-orgmode@gnu.org; Tue, 14 Sep 2021 12:33:57 -0400 Received: from ciao.gmane.io ([116.202.254.214]:39544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQBNb-0006A5-Cr for emacs-orgmode@gnu.org; Tue, 14 Sep 2021 12:33:56 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mQBNW-0002Ms-Ee for emacs-orgmode@gnu.org; Tue, 14 Sep 2021 18:33:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: Internal link broken when publishing (was org-id with ox-html) Date: Tue, 14 Sep 2021 23:33:43 +0700 Message-ID: References: <4617246.m1MCmUpgFQ@pluto> <1640082.E36kBsiRYQ@pluto> <4827285.5yCLvEFndJ@pluto> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 X-Woof-Bug: Inconsistent handling of id: links to other file during publish In-Reply-To: <4827285.5yCLvEFndJ@pluto> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.969, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631637277; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dnGok/QhNJsKOZgMj7eKFglgxnd5Xg/n3YwtiHj3H7w=; b=OQOt7j0d9UYFaYARjIe1KBx6UKdEdIiOPvn3qHiSd94iQsmop7FRETaUnUUUwHqPpGfljk Rl4RR7pwNFr6tBmSDg6+U9OzziFBtY3TyTxKcBe7vz/dVrFvCAPAj/DDXjZJUM0U0YsZZ/ WYb+m2gaWbsFt75094lZ/1AWcVSwX4/5IC/0qwhQFhGcGu3wZ/d6YqcCZBmpuqMTrwDKOz BsCD2ooKBB//Zs3sxwwRi3thRgFF0CU7S+50TzjxrSXRK2+GoITP3xeyNp/DlMTRvq0PuF ttMfLfgEesFBFhE+U0a8VWNb37SfL8aVH3p8IXbScT3QEqKPQn87yYvUF+0c+w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631637277; a=rsa-sha256; cv=none; b=VR/YBM1B5U1269WH9AZwspjv+9bidQnWLX/7hmTlgoIq66ROx6UuFX868J1L8rfDHVe/Yz 7/rbAsUjZazwvpAjc8AMuIwwmXduEsJT6mNZ4BdxXiovKWkLDdf+DgqFCxows0Wz/yXb5L dZfHUhd+i1HE1iwPHxh96t9l2zqNrCzxtKR0r1W89arpXNyx0zkZA8SHtyacwdjgzbDGl5 9KvWbKH1N9GulsE5s7wxhi1urtKSkJZQxPuI4oEqWhVESS+/pKNGpjOqCEAs+d18/DtJdi H4x1LRvOPS2ebqchU9ILcIC0p3FAO7jhOkl4+/L/qgM7pyoReWnNIoRO1aRq8g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=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-Spam-Score: -1.80 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=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: B5683EB1A X-Spam-Score: -1.80 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1gQoNLAh/+h2 As a kind of summary: During publishing of a project - "id:" links to headings from the same file are exported as short generated anchors like #org032777e or as anchors to custom ids when the latter are available - "Search heading" links to other files are exported as short generated anchors or as custom ids. - "id:" links to headings in external files are exported as ID value with "ID-" prefix. These links are *broken* currently. Expected behavior is the same style of anchors for particular heading, e.g. - value of custom_id property is used even for "id:" links - either value of id property or short generated anchor is used for links to a heading having id property (maybe it should be possible to customize preferred style) but the same for search heading text fuzzy links and "id:" links, internal and external ones. I do not mind to have both anchors with value of id and custom_id properties if they are defined for a header. My opinion is that value of id property should be used for heading anchor when available to guarantee stable links from other sites. I admit that default behavior may be short (perhaps unstable) anchors. On 07/09/2021 22:46, chris wrote: > On Tuesday, 24 August 2021 17:23:24 CEST Maxim Nikulin wrote: >> On 23/08/2021 03:42, inkbottle wrote: >> >> From my point of view it looks like a bug. >> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox.el#L4381 ... > I believe it's a bug, plain and simple. I am afraid that its fix would not be so simple. > With a unique org file, the `:ID: e54113f9-2ad7-4a86-94be-68ffc696de0b` are > resolved to `orgfa9c151` consistently. My opinion (in contradiction to Nicolas) is that anchors should be as stable as possible even in the absence of cross-references withing the document. It allows links from other sites to particular sections. That is why value of ID property is better than random anchor despite the former is longer. > There is a patch here: > https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132 > but, as I understand it, the workaround consists in treating `:ID:` similarly > as `:CUSTOM_ID:`, that is, exporting them "verbatim". If it were a patch, it would be easier to spot the changed part. This approach may be implemented in a bit cleaner way but I do not think that it will allow to use custom_id value for "id:" link if a heading has both (see `org-html-link' and `org-export-resolve-id-link'). >> checks for ID property. >> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox-html.el#L1659 >> queries CUSTOM_ID only. I suppose, ID should be here as well. A subtle >> point is which one (ID or CUSTOM_ID) should be used if both are defined >> for some headers. > > Yes, "ID should be here as well" => No. > That is the point I'm advocating above. > `:CUSTOM_ID:` are meant to be treated in a so-called "stable" way. That is to > say, the `CUSTOM_ID` you see in your org-file, is what you get in your HTML file > (also I've done some tests with that method, and I recall it wasn't working at > all in a multiple org files setting). > On the other hand, `:ID:` are meant to be treated through a *translation > table*, and should result in some `orgfa9c151` thing, on the HTML side. > Weaving the two methods together doesn't seem like "road to success". In a general case it is rather hard to get stable anchors, even having full history of changes. On the other hand I see no reason to avoid stable IDs where they exist. Looks like a reason for defcustom at least. I consider random anchors and the cache to make some of them stable as an unavoidable fallback when there is no better way (users avoid property drawers). >> Maybe it is possible to create workaround as a custom config without >> touching of Org code. I guess, "nicer" ids may be replaced by values of >> ID property. Examples (I tried none of them): >> - >> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading >> https://orgmode.org/list/E1jxAjq-0004Dk-LH@lists.gnu.org/ (TEC. >> [Interest] Determanistic Org IDs. Sun, 19 Jul 2020 22:27:31 +0800) ... > The methods above are, as I understand it, all about making more beautiful > links to export to HTML. > Not about the "translation table" devised in `ox.el` being broken when working > with multiple org-files. My idea of a workaround was to throw away all code deriving pretty link and to put ID value instead.