And of course I forgot to add the extension to the file name format in the filter. You will have to adjust the variables at the top to reflect your reality anyway of course! Den ons 5 feb. 2020 23:50BPJ skrev: > I *think* the attached filter will do the trick. It should make one pass > where it associates each main section id with a sequential filename like > the ones you would get from csplit need every element id with the current > section, then in a second pass it should visit all links and prepend the > appropriate file name to all internal links, unless the link appears to be > in the same section as the target. > > BTW if you use csplit you will probably want to use a custom "suffix > format" which includes the right file extension. Just pass an option `-b > '%03d.md'` for example. > > Den ons 5 feb. 2020 20:40John MacFarlane skrev: > >> >> Your filter would also need to rewrite internal links >> so they don't break when the document is split across files. >> >> BP Jonsson writes: >> >> > I don't think so but you can use a Lua filter to insert a certain string >> > before each section heading and then use the csplit command to split the >> > file on that separator. >> > >> > >> > >> https://www.gnu.org/software/coreutils/manual/html_node/csplit-invocation.html#csplit-invocation >> > >> > >> > If you are on Windows have a look here: >> > >> > >> > https://tinyapps.org/blog/201606040700_tiny_unix_tools_windows.html >> > >> > E.g. >> > >> > ``````lua >> > local split_level = 2 >> > >> > -- Define once, use repeatedly >> > local sep = pandoc.RawBlock( >> > 'markdown', 'XXXsplitXXX' >> > ) >> > >> > function Header (elem) >> > if split_level ~= elem.level then >> > return nil >> > else >> > return { sep, elem } >> > end >> > end >> > `````` >> > >> > then >> > >> > ``````sh >> > pandoc -L sep.lua my-project.md \ >> > | csplit -f my-project -n 3 --suppress-matched - /XXXsplitXXX/ {*} >> > `````` >> > >> > Of course the separator may be anything, but it must not otherwise >> occur in >> > your document and should better not contain any regular expression >> > metacharacters; stick to ASCII alphanumerics and you should be good. >> > >> > >> > Den ons 5 feb. 2020 15:08Szabolcs Horvát skrev: >> > >> >> I am working on putting some documentation online, and I am generating >> the >> >> final pages with pandoc. >> >> >> >> Currently I have a gigantic markdown file. Does pandoc have any >> features >> >> to generate separate HTML pages for each section? I hope to do this in >> a >> >> way that links still work between pages, and that the table of >> contents is >> >> still usable. >> >> >> >> For reference, this is the current state of the final page (work in >> >> progress): http://szhorvat.net/mathematica/IGDocumentation/ >> >> >> >> -- >> >> 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/ad056ff9-2db6-40ae-97a9-b552c85d99b9%40googlegroups.com >> >> < >> https://groups.google.com/d/msgid/pandoc-discuss/ad056ff9-2db6-40ae-97a9-b552c85d99b9%40googlegroups.com?utm_medium=email&utm_source=footer >> > >> >> . >> >> >> > >> > -- >> > 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/CAFC_yuQEpq3qLAJYQA9Tjo9zeJO0NnGS3Q2nzLmxYJK8GaNbPA%40mail.gmail.com >> . >> > -- 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/CADAJKhCxAM6VmKdQtpMo%2Bz1k9ZFJoochWGqRFvkZZ4E3MK-Uiw%40mail.gmail.com.