Add support for frontmatter by taniki · Pull Request #635 · prettier/plugin-pug

frontmatter support in markdown, css, and html seems to be done through support of embeds:


const printer = {
  preprocess,
  print: genericPrint,
  embed,
  massageAstNode: clean,
  hasPrettierIgnore,
  insertPragma,
  getVisitorKeys,
};

export default printer;

but I can't find such mecanism in yours. should insert something like inserting a case in the switch section?

Yeah... that might be a huge problem, because I implemented plugin-pug when a lot of such things where not available or stable, and then also as pug is a "language" which is very easily written from left to write, top to bottom, it was far more easy to just process the token stream as an array / iterator.

You could have a look how embedded js or css is formatted right now as well as some expressions like embedded vue or angular syntax.
From that you might get a picture of how to achieve similar thing for frontmatter.