Update: your suggestions worked. Thank you for excellent support. tisdag 1 september 2020 kl. 12:05:48 UTC+2 skrev Henrik Klang: > I meant the entire section with both headline and body. > > Thanks for the suggestions guys, I will try them out! > > / Henrik > > tisdag 1 september 2020 kl. 11:35:15 UTC+2 skrev Albert Krewinkel: > >> >> Denis Maier writes: >> >> > You mean like removing the sub section header? Or the whole subsection >> until the >> > start of the next section? >> > Both should be possible with a lua filter. The first is trivial, the >> second >> > more complex (at least for me ;-). But I doubt it wouldn't be possible. >> > The tricky part is possibly that pandoc's AST does not reveal the >> hierarchy >> > here: >> > >> > [Header 1 ("header-1",[],[]) [Str "Header",Space,Str "1"] >> > ,Para [Str "Text"] >> > ,Header 2 ("header-2",[],[]) [Str "Header",Space,Str "2"] >> > ,Para [Str "Text"] >> > ,Header 2 ("header-2-1",[],[]) [Str "Header",Space,Str "2"] >> > ,Para [Str "Text"] >> > ,Header 1 ("header-1-1",[],[]) [Str "Header",Space,Str "1"] >> > ,Para [Str "Text"]] >> > >> > So, I imagine you have to walk over the AST and when you encounter a >> "Header 2" >> > element, you delete this and everything else until you find the next >> "Head 1" >> > element. >> >> That's a good approach. Untested Lua: >> >> local keep_deleting = false >> function Block (b) >> if b.t == 'Header' and b.level >= 3 then >> keep_deleting = true >> return {} >> elseif b.t == 'Header' then >> keep_deleting = false >> elseif keep_deleting then >> return {} >> end >> end >> >> The alternative is to let pandoc wrap all sections in divs and to delete >> those that are undesired. See >> https://gist.github.com/tarleb/a0f41adfa7b0e5a9be441e945f843299 >> >> >> -- >> Albert Krewinkel >> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >> > -- 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/dea98b71-e65b-401e-b3df-338cd80ae369n%40googlegroups.com.