From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/24329 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Separate tables of contents for each section Date: Sat, 1 Feb 2020 12:42:06 +0100 Message-ID: References: <3d838861-862c-4b15-8d91-a9b37d671736@googlegroups.com> <2cf07390-db35-422e-887a-bfde62a12a63@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ace0d9059d822eda" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="84918"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: bpj Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBG6I2XYQKGQEOQ2HWTI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Feb 01 12:42:24 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pg1-f189.google.com ([209.85.215.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ixrAN-000LuJ-3c for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 01 Feb 2020 12:42:23 +0100 Original-Received: by mail-pg1-f189.google.com with SMTP id 14sf5705523pgg.4 for ; Sat, 01 Feb 2020 03:42:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1580557342; cv=pass; d=google.com; s=arc-20160816; b=GDyKRyp3Z1wzPuWJTGZItICebX3JW5/7pFqC/MbYVOGdcN3ArPidx39/GEqIghi8hI 4QoX5Tn1d5cnY1tXcJo9fiUqVLo/3GI3j6EUL3JsBSwULsnAIcGiZ+Uio4NzqLqpj9Q4 lV5uzY9Exvt9ezbzQHdXMs9ohGet6cirOkLVLi+bX4rA/q+Y+P1WhXFxsEAvuA8vUelY QgJZZXHMRH+vX/KcatHGJPxTHmD+BAiPVEUozWHD7MP3gWZClRA8ZTMcIsRgkS9n8u1n 92YQC5Z6OBjQqlwf5R06e4KhTbVlns+yTmHGE5T7tVTJgmInLMvifiHBuc6L2dYXeI8S pEbA== 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:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:sender:dkim-signature; bh=YvQTN2czXzG699aTIWv0movODB28Q5xWD/S1OjsXvVU=; b=Tvl2qzsptrlokApQwYf36styJwGZwW6WnW6qGSLZdIJoCy4Wjst77TVmy0/oUD/zf7 OeHe4JQ469JVjJbwvuvHerybqPkrANk+D2VHGL3VDkNrdWy4QYhpP6LUcHiwIYSJv02L CGq9RSHjX++0hsZZR6pIRdt0dcGCvufzJ2aAU8dOl2Yvb2QS+pDhejlDkLf/xyX5jzq6 qjnpDUreYniqZU6SW4L8TI5+6S5+yQRKz+5KuOi/GFAOq3RaKtJJ4gPo/ctHT58Wc96b UpSw5z2wgcn63d343nWykQZnZ9WF9NRUWheXeSRI+h0D0UEu7vTRaNSRrTEXt93vieoz W4TA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.167.173 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:reply-to:from:date :message-id:subject:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=YvQTN2czXzG699aTIWv0movODB28Q5xWD/S1OjsXvVU=; b=d1jbGLOupinDmUCMri4bPOLxj5+eZY7d8rjqACBoUplmpjAVUZJefO+pRVoNiJeAtG GA+BUiGRknbttL4ZeTVO4ghexoDe8RtxCwrPYHnKLrLn6C6TJGKjTYkUYeYeqN8Ol9dz F3ovu2cTDr6NJxU10HbPivRHE/kouX+D2++CSjiKAY1zpOK40W4lMvDRLmK7ATKWEldO HLzvu95r+hKnVv49By4cvscW/OnrsiTTmpbow0LP0CiZf9vrpHYTyomx431AYGsq5sAb CyoHIWzmqyRIRXqWKxIJUmkmLsaPfqTWshDs5/TEE9UJ9t9O4DmGU/QUysTeJCs8aBKB m9mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to :reply-to:from:date:message-id:subject:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=YvQTN2czXzG699aTIWv0movODB28Q5xWD/S1OjsXvVU=; b=DTHF66gNuBX7TMI3zcU9tvjun+YXrPYqUjpWGFeezUyE8bI39LEr4aNOA9a7r6Fp8Y uNILcrOxqUO2IhdD7nLtnZkuagrnvyn+yGvtX6p4oX3sNMH7fovJHFtAo7w3/xoRuNPX vVUZDYh34WF/ZuH4nmsP5CX+40/qCiLbgOyuVden0tGcdBsJDDRJcle8eMWOdJSMjHVv nkWqam676zpYb3A75yTfHv8zF3vkUhhknTs5oKulDN2JCo74/e91G7RT9l+nRGkFZuBq NG+18yuYFSWAShg8PD4IxwkmwqzLeiLc7SBywPbJi0qG6rMIrZ0Zah+jy7bzEJ3YO6Qp zzOw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAW70CqSMVyS5xSr6E1bDfOAcwSVd3boomKpPsHIGv1AWslSz+Dd XJ2lue5P7nPajW36dSdYeFI= X-Google-Smtp-Source: APXvYqwxMXbpKXVJsTMKRuTjr66YC6b4e3tJWPlWx7VqxGKUJIPAPkYtBuFCHAhk8BGA3vuBe/RX1g== X-Received: by 2002:a17:902:524:: with SMTP id 33mr15078767plf.241.1580557341870; Sat, 01 Feb 2020 03:42:21 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:90a:1bc6:: with SMTP id r6ls5370789pjr.1.canary-gmail; Sat, 01 Feb 2020 03:42:18 -0800 (PST) X-Received: by 2002:a17:902:9691:: with SMTP id n17mr15040202plp.304.1580557338632; Sat, 01 Feb 2020 03:42:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580557338; cv=none; d=google.com; s=arc-20160816; b=doIwTDRuW9CUcMeUbPkqRln1hDbj4LVkchwm3sZ2Vdrl1EvooHuoXdeA8UDnMGTYwQ Cyo7yu8ipDiudGc2Fb9mhORvgno0mGOrGC3be9M4THvAg0hVKQvatmwlpkYNzBpouKyj RQ3mQ+7HjY5Qn/s5fJ67aXXfcxfKpVQLonC9KaXHXYLsIB8RE0sBRyWj9E5nFXTEMgwM tudpcSj7REOi+ATjNU/V/2ZiCIsQh4xIoVzinT3uNXIi0l9azZqBNiOmYwrZm5hqbO/h +UeX1bIq5N/oKlNHO/C9fP57z7pcNkutfm7ZkGYKXDOsdBpP3XF5pr4HPI0CQxCrQUbo V1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version; bh=ywl8RQFHgujHj87R3HTtv7sYn0YDoQf5KKZPd6gnWno=; b=C9tvEa9Zr1vmDuX8axwNvte2rr9/Gbxoc3x/e91a8SDBbjX2iSttdE5AVf9gGf+P7x YBnHpJ+ZAeXYhvkvuVy5VFdj+cGDLXdPS3v2YJ6ivOU25ATjjTKqdGX8hQLeMgv55bc9 tDR9Uoe5qOey9WM4KsXpVzfCHgP4aVLCsBAZDYa5RE7flqlooNbaPBs81KC4i7xIJVWN 0IPN1y58yJCWjPaNMYFTgn4bWItSYGVd7dq9pCil743B5IykJ0kPRf139h04DDLoFy0u RfIkFPcI1WD5PYpaPEZyOHuRp09wHkVwgF+ZNHYJYOU8UmsTG1ufgN8BB0IPFOX8hElU T3ag== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.167.173 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com. [209.85.167.173]) by gmr-mx.google.com with ESMTPS id i16si666824pju.1.2020.02.01.03.42.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Feb 2020 03:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.167.173 as permitted sender) client-ip=209.85.167.173; Original-Received: by mail-oi1-f173.google.com with SMTP id v19so10027814oic.12 for ; Sat, 01 Feb 2020 03:42:18 -0800 (PST) X-Received: by 2002:aca:a816:: with SMTP id r22mr9412586oie.1.1580557337942; Sat, 01 Feb 2020 03:42:17 -0800 (PST) In-Reply-To: X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.167.173 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 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:24329 Archived-At: --000000000000ace0d9059d822eda Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Having done a diff I see there were some easy-to-make but embarrassing omissions. Again sorry for posting untested code and thanks for posting the fixed version! Den l=C3=B6r 1 feb. 2020 12:17BPJ skrev: > Oops, sorry for forgetting to prepend the hash mark to the identifier =E2= =80=94 a > stupid omission! > I'm glad it worked after that fix. > > > Den l=C3=B6r 1 feb. 2020 08:59Szabolcs Horv=C3=A1t s= krev: > >> Thank you, this worked perfectly after a few minor code fixes and after >> prepending # to the identifier. >> >> For the convenience of those, who, like me, don't really know any Lua, I >> attach the fixed code. >> >> local chapter_level =3D 2 >> local toc_level =3D 3 >> local headings =3D {} >> local current_chapter =3D nil >> >> local function collect_headings (head) >> if head.level =3D=3D chapter_level then >> local id =3D head.identifier >> current_chapter =3D { >> chapter =3D id, >> toc =3D {}, >> } >> headings[id] =3D current_chapter >> elseif head.level =3D=3D toc_level then >> if current_chapter then >> local toc =3D current_chapter.toc >> toc[#toc+1] =3D head >> end >> end >> return nil >> end >> >> local function build_toc (heads) >> local toc =3D {} >> for _,head in ipairs(heads) do >> local entry =3D { >> pandoc.Plain{ >> pandoc.Link( >> head.content:clone(), -- text >> '#' .. head.identifier, -- target >> "", -- empty title >> pandoc.Attr( >> "", -- empty identifier >> {'local-toc-link'} -- class >> ) >> ) >> } >> } >> toc[#toc+1] =3D entry >> end >> return pandoc.Div( >> { pandoc.BulletList(toc) }, >> pandoc.Attr( "", {'local-toc'} ) >> ) >> end >> >> >> local function insert_toc (head) >> if head.level =3D=3D chapter_level then >> local id =3D head.identifier >> if headings[id] then >> local toc =3D build_toc( >> headings[id].toc >> ) >> return {head,toc} >> end >> end >> return nil >> end >> >> return { >> { Header =3D collect_headings }, >> { Header =3D insert_toc }, >> } >> >> >> On Friday, 31 January 2020 21:31:31 UTC+1, BP wrote: >>> >>> I believe a change has been made so that Lua filters now traverse the >>> document in linear order. If this is the case in the latest version of >>> Pandoc it should be doable with a two-pass filter: first a pass which >>> collects the headings and then a pass which inserts the TsoC. If you wa= nt >>> hierarchical section numbering you probably also need to do a first pan= doc >>> run which inserts the numbering and then a second pandoc run with the >>> filter to insert the TsoC. Something like this: >>> >>> (Warning 1: Untested code! >>> Warning 2: Make sure not to overwrite any existing file! >>> Warning 3: Assumes that all chapters are heading level 2 =E2=80=94 ch= ange the >>> chapter_level and toc_level variables to match! >>> Warning 4: Assumes that each section/chapter has a unique identifier= ! >>> ) >>> >>> local chapter_level =3D 2 >>> local toc_level =3D 3 >>> local headings =3D {} >>> local current_chapter =3D nil >>> >>> local function collect_headings (head) >>> if head.level =3D=3D chapter_level then >>> local id =3D head.identifier >>> current_chapter =3D { >>> chapter =3D id >>> toc =3D {} >>> } >>> headings[id] =3D current_chapter >>> elseif head.level =3D toc_level then >>> if current_chapter then >>> local toc =3D current_chapter.toc >>> toc[#toc+1] =3D head >>> end >>> end >>> return nil >>> end >>> >>> local function build_toc (heads) >>> local toc =3D {} >>> for _,head in ipairs(heads) do >>> local entry =3D { >>> pandoc.Plain{ >>> pandoc.Link( >>> head.content:clone(), -- text >>> head.identifier, -- target >>> "", -- empty title >>> pandoc.Attr( >>> "", -- empty identifier >>> {'local-toc-link'} -- class >>> ) >>> ) >>> } >>> } >>> toc[#toc+1] =3D entry >>> end >>> return pandoc.Div( >>> { pandoc.BulletList(toc) }, >>> pandoc.Attr( "", {'local-toc'} ) >>> ) >>> end >>> >>> >>> local function insert_toc (head) >>> if head.level =3D chapter_level then >>> local id =3D head.identifier >>> if headings[id] then >>> local toc =3D build_toc( >>> headings[id].toc >>> ) >>> return {head,toc} >>> end >>> end >>> return nil >>> end >>> >>> return { >>> { Header =3D collect_headings }, >>> { Header =3D insert_toc }, >>> } >>> >>> >>> Den fre 31 jan. 2020 19:27Szabolcs Horv=C3=A1t skre= v: >>> >>>> Hello everyone, >>>> >>>> I am converting a Markdown file to HTML. >>>> >>>> I can insert a table of contents at the beginning using the --toc >>>> option. >>>> >>>> Is it possible to insert additional tables of contents under each >>>> level-two or level-three heading? >>>> >>>> I am looking to create something similar to the organization of this >>>> page: https://igraph.org/c/doc/igraph-Visitors.html#idm209455316208 >>>> >>>> Szabolcs >>>> >>>> -- >>>> 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 pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/pandoc-discuss/3d838861-862c-4b15-8d= 91-a9b37d671736%40googlegroups.com >>>> >>>> . >>>> >>> -- >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> email 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/2cf07390-db35-422e-887a= -bfde62a12a63%40googlegroups.com >> >> . >> > --=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/CADAJKhBP2hzpg6wLOdN649H3pgNf3JOf%3D_Nd-v1cmAqiVPdpQQ%40mail= .gmail.com. --000000000000ace0d9059d822eda Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Having done a diff I see there were some easy-to-make but= embarrassing omissions. Again sorry for posting untested code and thanks f= or posting the fixed version!


Den l=C3=B6r 1 feb= . 2020 12:17BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org>= ; skrev:
Oops, so= rry for forgetting to prepend the hash mark to the identifier =E2=80=94 a s= tupid omission!
I'm glad it worked after that fix.


Den l=C3=B6r 1 feb. 2020 08:59Szabolcs Horv= =C3=A1t <szhorvat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Thank you, this worked perfectly after a few mi= nor code fixes and after prepending # to the identifier.

For the convenience of those, who, like me, don't really know any Lua,= I attach the fixed code.

local chapter_level =3D 2<= /div>
local toc_level =3D 3
loca= l headings =3D {}
local current_chapter =3D nil

local function collect_headings (head)
if head.level =3D=3D cha= pter_level then
local id =3D head.identifier
current_chapter =3D {
cha= pter =3D id,
toc =3D {},
}
head= ings[id] =3D current_chapter
else= if head.level =3D=3D toc_level = then
if current_chapter then
local toc =3D curr= ent_chapter.toc
toc[#t= oc+1] =3D head
end
e= nd
return nil
end=

local function build_toc= (heads)
local toc =3D {}
for _,head in ipairs(heads) = do
local entry = =3D {
pandoc.Plain{
pandoc.Link(
head.content:clone(), -- text
'#' .. h= ead.identifier, -- target
= "", -- empty title
pandoc.Attr(
"", -- empty identifier
{'local-toc-link'} -- class
)
)
}
}
toc[#toc+1] =3D entry
end<= /span>
return pandoc.Div(
{ pandoc.BulletList(toc) },
pandoc.Attr( ""<= /span>, {'local-toc'} )
<= div> )
end


local = function insert_toc (head)
= if head.level =3D=3D chapter_le= vel then
local id =3D head.ident= ifier
if headings= [id] then
local toc =3D build= _toc(
headings[id].t= oc
)
r= eturn {head,toc}
end
end
return nil
end

return {
{ Header =3D collect_he= adings },
{ Header =3D insert_toc },
}


On Friday, 31 January 2020 21:31:31 UTC+1, BP wrote:
I believe a change has been m= ade so that Lua filters now traverse the document in linear order. If this = is the case in the latest version of Pandoc it should be doable with a two-= pass filter: first a pass which collects the headings and then a pass which= inserts the TsoC. If you want hierarchical section numbering you probably = also need to do a first pandoc run which inserts the numbering and then a s= econd pandoc run with the filter to insert the TsoC.=C2=A0 Something like t= his:

(Warning 1: Untested code= !
=C2=A0 Warning 2: Make sure not to overwrite any e= xisting file!
=C2=A0 Warning 3: Assumes that all cha= pters are heading level 2 =E2=80=94 change the chapter_level and toc_level = variables to match!
=C2=A0 =C2=A0Warning 4: Assumes = that each section/chapter has a unique identifier!
)=

local= chapter_level =3D 2
local toc_level =3D 3
local headings =3D {}
local current_ch= apter =3D nil

local func= tion collect_headings (head)
=C2=A0 if head.level = =3D=3D chapter_level then
=C2=A0 =C2=A0 local id =3D= head.identifier
=C2=A0 =C2=A0 current_chapter =3D {=
=C2=A0 =C2=A0 =C2=A0 chapter =3D id
=C2=A0 =C2=A0 =C2=A0 toc =3D {}
=C2=A0 =C2= =A0 }
=C2=A0 =C2=A0 headings[id] =3D current_chapter=
=C2=A0 elseif head.level =3D toc_level then
=C2=A0 =C2=A0 if current_chapter then
=C2=A0 =C2=A0 =C2=A0 local toc =3D current_chapter.toc
=C2=A0 =C2=A0 =C2=A0 toc[#toc+1] =3D head
=C2= =A0 =C2=A0 end
=C2=A0 end
=C2= =A0 return nil
end

=
local function build_toc (heads)
= =C2=A0 local toc =3D {}
=C2=A0 for _,head in ipairs(= heads) do
=C2=A0 =C2=A0 local entry =3D {
=C2=A0 =C2=A0 =C2=A0 pandoc.Plain{
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 pandoc.Link(
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 head.content:clone(), -- text
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 head.identifier, -- target
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "", -- empty title
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pandoc.Attr(
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "", -= - empty identifier
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 {'local-toc-link'} -- class
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 )
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 toc[#toc+1] =3D= entry
=C2=A0 end
=C2=A0 retu= rn pandoc.Div(
=C2=A0 =C2=A0 { pandoc.BulletList(toc= ) },
=C2=A0 =C2=A0 pandoc.Attr( "", {'= local-toc'} )
=C2=A0 )
en= d


local function insert_toc (head)
=C2=A0 if hea= d.level =3D chapter_level then
=C2=A0 =C2=A0 local i= d =3D head.identifier
=C2=A0 =C2=A0 if headings[id] = then
=C2=A0 =C2=A0 =C2=A0 local toc =3D build_toc(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 headings[id].toc
=C2=A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 = =C2=A0 return {head,toc}
=C2=A0 =C2=A0 end
=C2=A0 end
=C2=A0 return nil
end

return= {
=C2=A0 { Header =3D collect_headings },
=C2=A0 { Header =3D insert_toc },
}


<= div dir=3D"ltr">Den fre 31 jan. 2020 19:27Szabolcs Horv=C3=A1t <szho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Hello everyone,

=
I am converting a Markdown file to HTML.

I can insert a table of contents at the beginning using the --toc option.=

Is it possible to insert additional tables of con= tents under each level-two or level-three heading?

I am looking to create something similar to the organization of this page:= =C2=A0https://igrap= h.org/c/doc/igraph-Visitors.html#idm209455316208

Szabolcs

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-...@googlegroups.c= om.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-d= iscuss/3d838861-862c-4b15-8d91-a9b37d671736%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe@goo= glegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2c= f07390-db35-422e-887a-bfde62a12a63%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CADAJKhBP2hzpg6wLOdN649H3pgNf3JOf%3D_Nd= -v1cmAqiVPdpQQ%40mail.gmail.com.
--000000000000ace0d9059d822eda--