From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32179 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Customising toc in HTML Date: Tue, 14 Feb 2023 15:26:30 +0000 Message-ID: References: <6035b070-9f83-41e3-b392-5f6970e36757n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13123"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBKOQV2PQMGQEOX6UCGA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 14 16:26:38 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f185.google.com ([209.85.208.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pRxCY-0003FI-LL for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 14 Feb 2023 16:26:38 +0100 Original-Received: by mail-lj1-f185.google.com with SMTP id a4-20020a2ebe84000000b002935008af2asf1645747ljr.19 for ; Tue, 14 Feb 2023 07:26:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676388398; cv=pass; d=google.com; s=arc-20160816; b=VYUOIqIdHxP3RhnIJkqxcR5VFtvROfd5qA5oRnspa2Eao+tMNqPFJh5fQTR4tWdCAz o6OdS7EUAOBdinPlb9y51RJHx8Xr0W5wltNfJnc/09PyYjlsNhNOshYFsKX1gg9Rx977 uKbgXjZ+xJnO1WR1jYz/sCBQ/G34XSfnXNkJYg22cPXCW9B+MxAM/4OMvCfS7Wcs2ZqA AkRXy07cowzxmCC9VBViASP9PVycGtNND9h4ZuIYziFUu4F01JQsSvqn3bkkzJ9iIoDq +eWDSQXESwLKD3HgK240pVDUIdq/YqSBTStcxAUIvSwHp0qKVWtcjC1oCuDDdQMgfL2K T1eA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=LDxPyTwpdTubcTWtdIqYP78TCRdTvFz0U2pevhbu2gQ=; b=u9/R8JCYXrPBdJ4fMxJYoKhiIjgPhYihoIW9hzpuHmcSjV/CpUx2urYIzYVc2xhgdY +ahOlMNCgX3/28ftjCwF7exvGhRZdH18dLPIDZLN+sfCsYjFMuEGbjE/ApOTIAzjjO4b lrj/VsgMwUxj3i7DInQXvsPqNas4gZjHypAZnKbtOzGQC4TnraSNZjcHSmseo7mXDEWO 7Na/7QsUWZn+yrHWJlK1a1/xQGkyXSzl9jQXbTaVlpwKkn5PK34s6HLhJrRqBkfG8Q9J xKwYTIkNnX8W/POsn8nXxleEbF6KLPd+lQObhLhDT+ssTf9b3hzZWjIJdo03yWQY68RX e/rw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bReDftQm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=LDxPyTwpdTubcTWtdIqYP78TCRdTvFz0U2pevhbu2gQ=; b=CGGpIpZ2o6J/6s6FfZ3UPChOgJJW5GytRhDJeT22HZgoyCufr4ynG0+dTK5YPJ+neb 7E6OsSkUUtirIhIEhF4BkMaM3+yZx85wRpW82v2hHs6PzCGzdynoG1iIIERbXZ5DZY5Z ucDneyB5KDbTvfuq8QYp3o0Z46FI+7Z4wMJM2Dj1XvIV33jdxmwM/91nJEd9EBHWf1+Z RyjH/mICQf2CENzEvyf/SUElArYGHebTxhnHxu4iFyhWxA4mZujqfhuClvJvgCgDAQzZ E+3YE9Yqv6HKoNhjBJjgHJfWlJTe+HfYpq2u6emr/jClx X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=LDxPyTwpdTubcTWtdIqYP78TCRdTvFz0U2pevhbu2gQ=; b=PwgdPiNY3ZWCUQ3X3H61CdW6gk2mcwCClGcEnsjZ3TUmBVj0trGRAg9woMmYIHtmmx LIXdUTe+eTJXzVxD5ybFJDQIfpm5i9V4w+pUO7BOBsD+WtvzLPqVHVB2tC2OLrQY1tqn XSelSo8xoAU2wdgqTxGneIu6v64uT25NlJm12hkYIkqkfbdZn4Wf4g3zs/QtIWPSN4Bn VA6+Ff8xGDfKseGvvghVyf77ZB0UxZrqN+IeNdhZeAvKmSqhYWDOOTBH/s+BoMs+A6M2 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKWvh/E+g9XJlnP1/Nw1+qzkF3gNFqYvD43Vi+QE7sZOa39l4daG 6wxLYtIwAEDo5VQUtX0/jfg= X-Google-Smtp-Source: AK7set8MxJZcFxCAiSrcqqV3DB6C6nWsPIHoTpzrryyQxC6jyDhczs4s5B9beY2DBF9/suXAUPcaRg== X-Received: by 2002:a05:651c:1038:b0:293:54ee:9e37 with SMTP id w24-20020a05651c103800b0029354ee9e37mr245494ljm.24.1676388398100; Tue, 14 Feb 2023 07:26:38 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:4e12:0:b0:293:186a:1056 with SMTP id c18-20020a2e4e12000000b00293186a1056ls2438562ljb.10.-pod-prod-gmail; Tue, 14 Feb 2023 07:26:32 -0800 (PST) X-Received: by 2002:a2e:a22f:0:b0:293:4da1:d0f9 with SMTP id i15-20020a2ea22f000000b002934da1d0f9mr1423447ljm.39.1676388392404; Tue, 14 Feb 2023 07:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676388392; cv=none; d=google.com; s=arc-20160816; b=mJgCi9HdJHXnDaOP0CfxDpCozMDe6yA40ZrYpsCZ8nfaBlgAP1ml/K2ov76nNwtqO7 SKJGQclUb+LfFsfihxfGhMfO3Jfx1T/NLCdMruZFeoQ2DFHMH5Ogpw6cFcKoI++Tl0ge iVnRHpAB94Yp6Jv4eI+cmfLUfxlTIWo0ckL8wojje+3BD+DHw2oqWQ5JWryk29Ra2Rx6 kI9B0FZ3/5YQ/osG6wc5nqMYVncwX9CPdYcWNYf0Xz7IC5KVGc4skw5p8n3tMH0wqG83 zpIuOHsOVtRnddzNxd5Iwh/xHSa26hvXDTVVtWHj3TcbiUl3ZRXA2nf5NgyVQFYMAC48 Go8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=SbH7erF/pAQy/IrSKyczap+jU3SSR8MOsAVQeqUfPFQ=; b=YPDQCXv3buJPSbuhSeCFI14Z2uWauZBZ6gQsBkAa5bg4B3GlfXd0drrzg+lHSFSkhW jWjYVHdKThF6r0g8WUkC8JU8MxzZgKNIwuZ3ttYt3Tm+TXCOezsmdV+xw+uVJuH8XfFw VxuSGIV9Ca3XZSVIRDjbx8lLoq7UOQcWEDZRjJyrNd10eht8ruU3QsfSXCqv31FgmgiG OnzPM2dhe6T+tynMU2/1fyEbsunZpOXzmsjm5PHRTJVil4tzzwjxzaUT+J2/lPdY3Ut8 GZU/98MIbj/MQ5bDdYWbt5HRPr3IpcspUkC04KjzAKD/jhqouSEf0aWgCajHyblxKHhe IJgw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bReDftQm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout02.posteo.de (mout02.posteo.de. [185.67.36.66]) by gmr-mx.google.com with ESMTPS id bx20-20020a05651c199400b002935fce5560si20937ljb.2.2023.02.14.07.26.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 07:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) client-ip=185.67.36.66; Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id AA72F2404E1 for ; Tue, 14 Feb 2023 16:26:31 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PGQ6H24QDz6tnD for ; Tue, 14 Feb 2023 16:26:31 +0100 (CET) Content-Disposition: inline In-Reply-To: X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bReDftQm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:32179 Archived-At: You can use a filter to generate programmatically the content of table-of-c= ontents. Here is a proof of concept (to be improved if you want e.g. to tak= e account of the header levels): ``` local toc_inlines =3D {} local function feed_toc_inlines(header) table.insert(toc_inlines, pandoc.Span(pandoc.Link(header.content, '#' .. header.identi= fier))) table.insert(toc_inlines, pandoc.RawInline('html', '\n')) end local function set_metadata(meta) meta['table-of-contents'] =3D toc_inlines return meta end return { { Header =3D feed_toc_inlines }, { Meta =3D set_metadata } } ``` However, I don't use HTML generation a lot=E2=80=94there may be a better wa= y. Le Tuesday 14 February 2023 =C3=A0 05:20:59AM, Thomas Hodgson a =C3=A9crit = : > The best solution I have found is to put this in my metadata: >=20 > ``` > table-of-contents: [Section one](#section-one)[Section= two] > (#section-two) > ``` >=20 > Which works, but has to be updated by hand. >=20 > On Sunday, 12 February 2023 at 15:16:48 UTC+1 Thomas Hodgson wrote: >=20 > Hi, >=20 > I'm wondering whether there's a way to change the HTML for a table of > contents. In particular, I'm wondering whether I could have something= like > this, instead of a unordered list: >=20 > ``` > > ``` >=20 >=20 > (I'm thinking about using <[1]https://readable-css.freedomtowrite.org= />, so > I want the TOC to fit what will work with that.) >=20 > Tom >=20 > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an= email > to [2]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [3]https://groups.google.com/d/m= sgid/ > pandoc-discuss/b1b171d9-87c7-4bac-8ab4-a0473c401519n%40googlegroups.com. >=20 > References: >=20 > [1] https://readable-css.freedomtowrite.org/ > [2] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [3] https://groups.google.com/d/msgid/pandoc-discuss/b1b171d9-87c7-4bac-8= ab4-a0473c401519n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/Y%2BuoJldDeeG4Yksr%40localhost.