From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KOLtKlJvRWMs9QAAbAwnHQ (envelope-from ) for ; Tue, 11 Oct 2022 15:27:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kMkRK1JvRWPsWQEA9RJhRA (envelope-from ) for ; Tue, 11 Oct 2022 15:27:46 +0200 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 76A2A41B1F for ; Tue, 11 Oct 2022 15:27:45 +0200 (CEST) Received: from localhost ([::1]:60010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiFIO-0001o7-Kw for larch@yhetil.org; Tue, 11 Oct 2022 09:27:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiDg1-0001V3-DG for emacs-orgmode@gnu.org; Tue, 11 Oct 2022 07:44:02 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:39700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiDfx-0006SU-5e for emacs-orgmode@gnu.org; Tue, 11 Oct 2022 07:44:00 -0400 Received: by mail-pj1-x102b.google.com with SMTP id v10-20020a17090a634a00b00205e48cf845so15722512pjs.4 for ; Tue, 11 Oct 2022 04:43:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=2B7U3UTvnBe1rubv2IBD5oVbx5mgIdkST7iLUqfr/Lc=; b=UoFLNr79N0h7K/aV2m06rZ4Bkg/k61hogF3gpeENyLgD1vLTRdx2PyEZTunaD4MSTF bdT95ekiJhCmsilARLwvfnfjPDjLTe1nvJdLhuqnfqK8GjNf0GzxW1+fq8DhOYyerguh vQYJ15yw9p/lwj2wL8qjtSV+lMJn82v5uXxW9uoC6sA4qDjcoIICEPFb0Ngo4cVREzqO Z4Ew3MvzvIosqdhBS8bznW9JbpeXqIL38hH0ZjfjLvDxvQj/KCNefpIIiS2/4XQFhIuM 6XT/GeJ63B0ZqNSFtHJZw4YS2qgY325SzBMR1b+MqyL1kUXJKAtb7sp7tDB0wjJIOwr/ x2/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2B7U3UTvnBe1rubv2IBD5oVbx5mgIdkST7iLUqfr/Lc=; b=tBrS1+K0VLNFHJZCbq59i+lU5yKh16LGASuaWG8Eo/bOZRKktsHJlRkNPCz5gQ3R7T VeqOLCscVt4E4PNgM2SOuBEH6WQ9/lzt1/xAKY9JOD1qOERwamCkWtqRSJ3sSA2J6vTd J8sZVin9TAIIapRsFIxArF9wnYzto5BrnoL+Xs5wAbIrrnlJn7tZhy+Q/wDENi0OjgDH huaHLCiADAvKPiV3B8yg8MHZC7lcuQPDM+gWC/roMCCfU2vA9/vCL5St1hQxgc7Kl5vi 5u/60mtDyK+i7w4WJrWvzDhzPzl0EO9sjKETOsHl7A7pNOhpJ2sQU0FKwmNtLauStSIM 8l+w== X-Gm-Message-State: ACrzQf1iVeNbxZY+aa1+FPP4mmHR6ovnlLiBDHnmMGSM+rnBTGqwh03F nev2d92pYToH0DFX6RK65vA= X-Google-Smtp-Source: AMsMyM4kBmw7IwDsJA8cmMy5Wwjkj9ElG+RnuTid4f7DTQoggyj/PaZxD8a3CYl0r0R/E+bdkGLiCQ== X-Received: by 2002:a17:902:c944:b0:178:4568:9f99 with SMTP id i4-20020a170902c94400b0017845689f99mr24180310pla.98.1665488635592; Tue, 11 Oct 2022 04:43:55 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:6c23:3ad5:f37d:541b]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b00180daa59314sm6605752plh.125.2022.10.11.04.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 04:43:54 -0700 (PDT) From: Ihor Radchenko To: Timothy Cc: Nicolas Goaziou , Tim Cross , emacs-orgmode@gnu.org, Samuel Loury Subject: [FR] [Revived] Human readable / customizable link anchors during export (was: stability of toc links) In-Reply-To: <8735v4hoxl.fsf@gmail.com> References: <87wnsx9rcj.fsf@nicolasgoaziou.fr> <87y2dc82ct.fsf@nicolasgoaziou.fr> <87sg3j4vbl.fsf@gmail.com> <33fd87ff1332b56114909973804df669@isnotmyreal.name> <87h7joibxc.fsf@gmail.com> <87pmycay41.fsf@gmail.com> <87h7jouiuk.fsf@nicolasgoaziou.fr> <875z03igpf.fsf@gmail.com> <87tunmskap.fsf@nicolasgoaziou.fr> <87fsz6boxa.fsf@gmail.com> <87fsz6sik0.fsf@nicolasgoaziou.fr> <87czuabm6w.fsf@gmail.com> <871raqsfzp.fsf@nicolasgoaziou.fr> <87a6pebkk8.fsf@gmail.com> <875z019w0r.fsf@nicolasgoaziou.fr> <8735v4hoxl.fsf@gmail.com> Date: Tue, 11 Oct 2022 19:44:32 +0800 Message-ID: <87fsfutwin.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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.29 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665494865; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2B7U3UTvnBe1rubv2IBD5oVbx5mgIdkST7iLUqfr/Lc=; b=Hwij66BcIvDTtazJMO5acaSH6TkLf8Sltrnh0YjbjG9sTS3SLqXFcmBc6kNTcLpRHNTBxL rSF44xQTAaQcg/VuIteTsK9bEJkLJfRSXra1GAvckXSxFzrIK5Gbza3hP/a5O1jB+2bpdB bXnNrWuaXORGDiG9z4+aIObb06DeEBRXEjr9VZCqKSyzGPXh0WzpZVW9uPoxchfq4ZnhvK t27f1bEOx9NWOMQDPS6uBKoc8tQ0csdd/6IusOGYrZ0RiQCdNGRALDm7Z33DnaXTlF2ND3 igsNk2rdjl2TD7HRkHUlKXr+QwbErq7BKqmPmulftKTECS3BcbhDAd9MAcFx9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665494865; a=rsa-sha256; cv=none; b=oHuM/oJXtU5Z8zIvTh99je66mzqc97QfrwN5J1NqNpBmvQzjS+7FpNPJHTRkqpZehbOVaw u+/mZ039YLKw1/y+wLG+F0z1qtVi8IwiTlyC5pEYM/zxBwZGPTJOciduKS+ELUHBKdD9/Q HXdcPmy6h/C/yBhkEk5/nfuWxrjzMZsXZddynDraW/QL/DzCW2MLfxmLcyf/h80Gj62at5 B2VT4KhUXa7IWNYmOc6i71vPcnGE3MYrAcVSAVYNWkjlrd98UUZE1pTdN+URbGvRizXJIL LvZt7Q3TWWAuoCChWe/wJHyFDIEaTMxdnOrLROdEbt7FSeAww7vwl3OA4H3rCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UoFLNr79; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.40 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UoFLNr79; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 76A2A41B1F X-Spam-Score: -3.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: X7RGpxx95Uq+ Timothy writes: >> Link stability is still an issue, even if the proposal gives a false >> sense of security in that area. I don't think we can solve it without >> creating a cache for export, where you store all previous references for >> a given file. Even this is not sufficient, because you can export >> buffers not attached to files. > > To me this is a case of "don't let the perfect be the enemy of the > good", though I do see that a false sense of security may be > problematic, I consider the benefits to outweigh this. I would like to revive this thread as we now have an important development happened after this discussion -- org-persist library. It can handle caching without a need to have a dedicated cache implementation for every use-case. To summarize the previous discussion: - Org export currently generates ugly link anchors, which degrade the export output quality. In particular, html export can generate link anchors like https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ditaa.html#org96b5528 Note that randomly generated #org96b5528 anchor - The anchors are not just unreadable, but also change on every single export. (Except for ox-publish, which maintains anchor cache; but not all the people use or need publishing) - The random anchors are there for a reason: it is difficult to derive anchors based on the heading title/contents and avoid duplicates and also keep track of the same heading being modified. If we have * duplicated heading Text * duplicated heading Text we cannot usefully derive the anchor from the identical headings even worse * unique heading * duplicated heading can be changed to * duplicated heading * duplicated heading and we cannot find out which old anchor was for which heading - Further, there appears to be no suitable _universal_ algorithm to generate human-readable anchors. Timothy proposed one, but it does not work well for non-Latin text. ---------------------------- Proposal: 1. To avoid collisions, we can add randomness to the anchors: * This is headline will be #this-is-headline-<4 random letters> 2. The generated anchors will be cached according to headline text + headline contents + headline number in the document via org-persist. During consequent exports, if two out of the three keys match, we take the cached anchor. 3. Instead of trying to find a silver bullet for human-readable anchor generator, we allow users to customize it. The default will be constant "org" yielding "org-Ajjq"-type anchors, just like we have now. But we can also provide other generators, like the one Timothy proposed, or better versions contributed in future if there is demand. WDYT? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at