Skip to content

dwash96/prettier-plugin-mixed-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prettier plugin that supports mixed PHP and short tags

This is mostly a workaround for the limitations put upon by @prettier/plugin-php, like not supporting <? or a trailing ?> and not dealing well with HTML and PHP mixed together.

This plugin works around them in various ways, like replacing <? for <?php proper, and first formatting the PHP code and then formatting it as HTML code.

It seems to work in my tests so far, but it is undertested, so unconsidered edge cases are very likely to occur.

WARNING: By leveraging the existing HTML and PHP plugins, we need to add them and prettier to the dependencies, which can lead to unexpected results if the code is formatted using a different version of prettier.

  • Fails with <?php, <=, or ?> when in an escaped position, like comments or string literals.

About

Prettier plugin that supports mixed PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%