Ah, sorry, I didn't read what you'd written sufficiently carefully. On Wed, 22 Jun 2022, 18:48 BPJ, wrote: > As I said YAML comments aren't preserved when reformatting Markdown source > with pandoc, which as far as I am concerned is a defect. > > Den ons 22 juni 2022 15:58William Lupton > skrev: > >> it also works to use YAML comments, e.g. >> >> % cat comment.md >> --- >> # this is a comment >> --- >> >> text >> >> --- >> # this is another comment >> --- >> >> % pandoc comment.md >>

text

>> >> On Wed, 22 Jun 2022 at 14:53, BPJ wrote: >> >>> I don't know if I or someone else has mentioned this before, but I just >>> realized that there is (another) simple trick to simulate "markdown >>> comments" as opposed to HTML comments: >>> >>> ``````markdown >>> ```{=comment} >>> This won't show up in HTML output! >>> ``` >>> >>> `This neither`{=comment} >>> >>> >>> `````` >>> >>> Theoretically this might break if there ever is an output format called >>> "comment" but I guess that is highly unlikely. >>> >>> It will also probably work with your local language's word(s) for >>> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations >>> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is >>> no problem. >>> >>> Also if you don't trust Pandoc to automatically reject raw elements with >>> a bogus format you can use a simple filter: >>> >>> ``````lua >>> local is_comment = { >>> 'comment', >>> 'com', >>> 'remark', >>> 'rem', >>> 'kommentar', >>> 'komm', >>> 'anmärkning', >>> 'anm', >>> 'athugasemd', >>> 'aths', >>> } >>> -- Turn the list into a set >>> for i=1,#is_comment do >>> is_comment[is_comment[i]] = true >>> is_comment[i] = nil >>> end >>> >>> local function raw (r) >>> if is_comment[r.format] then >>> return {} >>> else >>> return nil >>> end >>> end >>> >>> return { >>> { >>> RawBlock = raw, >>> RawInline = raw, >>> } >>> } >>> `````` >>> >>> Notably this filter can be used to remove such "comments" from Markdown >>> output, while otherwise they will remain when reformatting Markdown source >>> with Pandoc, which IMO is an advantage over YAML comments. >>> >>> I hope this is useful for others, >>> >>> /bpj >>> >>> -- >>> 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/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%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/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%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/CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA%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/CAEe_xxhzPYAc%3D6mrM7sukroZ%3DR7RoiHMfwkDwxpsVHUci3OANA%40mail.gmail.com.