{"library":"prettier-plugin-pegjs","title":"prettier-plugin-pegjs","description":"A Prettier plugin for formatting PEG.js and Peggy grammar files. v2.0.2 is the latest stable, requires Node >= 16 and ships TypeScript definitions. It supports standard Prettier options plus an 'actionParser' to format action code (JavaScript/TypeScript by default, configurable). Unlike generic formatters, it deeply understands PEG syntax, preserving code within actions. Available for browser via standalone bundle.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prettier-plugin-pegjs"],"cli":null},"imports":["import prettierPluginPegjs from 'prettier-plugin-pegjs'","import { printPrettier } from 'prettier-plugin-pegjs/standalone'","import { PegjsParser } from 'prettier-plugin-pegjs'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import prettier from 'prettier';\nimport prettierPluginPegjs from 'prettier-plugin-pegjs';\n\nconst code = `Expression = head:Term tail:(_(\"+\"/\"-\")_ Term)* { return tail.reduce(function(result, element) { if (element[1] === \"+\") { return result + element[3]; } if (element[1] === \"-\") { return result - element[3]; } }, head) }`;\n\nconst formatted = await prettier.format(code, {\n  parser: 'pegjs',\n  plugins: [prettierPluginPegjs],\n  tabWidth: 2,\n});\nconsole.log(formatted);","lang":"typescript","description":"Formats a PEG.js grammar string using Prettier with the plugin, demonstrating usage in a Node.js TypeScript environment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}