u can use a Lua filter which reads in a whitelist from the metadata itself and removes all metadata fields whose keys are not in the whitelist. Such a filter is attached with this message. If you have any metadata keys which should be on the whitelist for the current project put them in your metadata as a list of strings under a key 'meta_whitelist', with one string (metadata key to whitelist) per line. The field 'meta_whitelist' itself should probably not be on the list! You probably want to put the list in a YAML file and include it with the `--metadata-file` option, or under the `metadata:` field in a defaults file. It might look like this: meta_whitelist: - address - phone - email or in a defaults file: metadata: meta_whitelist: - address - phone - email # IMPORTANT You almost certainly want to run this filter after all other filters, since they may depend on metadata which this filter removes. Den mån 9 aug. 2021 22:57Sean McDaniel skrev: > Thank you John. Your suggestions got me most of the way there: the > markdown code blocks with the +raw_attribute processing are correctly > passing through the sections I want untouched and the +yaml_metadata_block > is keeping the header content I want. > > The remaining issue which is giving me trouble is that +yaml_header_block > is also including all other document metadata and not just the variables > I've defined, i.e. stuff like > > autoEqnLabels: false > autoSectionLabels: false > ccsDelim: ", " > ccsLabelSep: — > ccsTemplate: | > *i* > *c**c**s**L**a**b**e**l**S**e**p* > *t* > chapDelim: . > > and so forth. > > Is there a way to include just the variables I've defined in the converted > document? E.g. > > --- > title: My Title > metadata: > description: 'My description' > keywords: 'keyword1, keyword2, keyword3' > author: 'Sean McDaniel' > sitemap: > changefreq: monthly > page-toc: > active: true > process: > twig: true > --- > > I've looked at the appropriate section in the Pandoc documentation and it > seems like I might need to create a custom template. Is this correct? > > Thank you, > > Sean > > On Sun, Aug 8, 2021 at 2:31 PM John MacFarlane wrote: > >> Sean McDaniel writes: >> >> > All, >> > >> > I need to convert documents from CommonMark to Markdown PHP Extra. Some >> of >> > my markdown documents have multiple tables in multi-line format that my >> > application (Grav CMS) doesn't support. >> > >> > I'm having two issues with the conversion process that I haven't been >> able >> > to figure out. >> > >> > First, I have opening and closing square-bracket tags that I don't want >> > converted. E.g. [notice] some text... [/notice] gets converted to >> > \[notice\] some text... \[/notice\]. I've tried enclosing these >> sections in >> > a plain fenced block but I don't want the text indented. >> > >> > Is there a way to either prevent backslash escaping of special >> characters >> > (preferred) >> >> No. We try to play it safe, and it's very difficult for the >> writer to tell if a bracketed text would inadvertently become a link. >> >> > or keep blocks of text verbatim? >> >> Well yes, you can mark something as raw Markdown using the "raw >> attribute." >> >> `[my notice]`{=markdown} >> >> You'll need to tell pandoc to use the raw attribute extension: >> >> pandoc -f commonmark+raw_attribute -t markdown_phpextra >> >> > Second, I have a YAML header that I'd like to keep untouched that's >> being >> > removed. Is there a way to output the same YAML header to my converted >> > document? >> >> Try with >> >> pandoc -f commonmark+raw_attribute+yaml_metadata_block -t >> markdown_phpextra+yaml_metadata_block -s >> > -- > 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/CAML5wTUJ%2BsvOhMUi2GwtPw0-_sx-GrRtG5teCihq6WmGXjZ8Cg%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/CADAJKhDj%3Dk9Ue0_iL2wWdQkpHXB0Em9RcnqeZXu5sHrAHOjYSA%40mail.gmail.com.