Format HTML in PHP

Provides formatting for the HTML code in PHP files using JSbeautify - Works well paired with a PHP.

Integration with visual studio code

Install through vscode extensions. Search for Format HTML in PHP.

settings.json

{
    "html.format.enable": true,
    "html.format.contentUnformatted": "wbr,pre,code,textarea,style,script",
    "html.format.endWithNewline": true,
    "html.format.extraLiners": "head, body, /html",
    "html.format.indentHandlebars": false,
    "html.format.indentInnerHtml": false,
    "html.format.maxPreserveNewLines": null,
    "html.format.preserveNewLines": true,
    "html.format.wrapLineLength": 120,
    "html.format.wrapAttributes": "auto",
}

Enable/disable default HTML formatter.

{
    "html.format.enable": true,
}

List of tags, comma separated, where the content shouldn't be reformatted. null defaults to the pre tag.

{
    "html.format.contentUnformatted": "wbr,pre,code,textarea,style,script",
}

End with a newline.

{
    "html.format.endWithNewline": true,
}

List of tags, comma separated, that should have an extra newline before them. null defaults to "head, body, /html".

{
    "html.format.extraLiners": "head, body, /html",
}

Format and indent and.

{
    "html.format.indentHandlebars": false,
}

Indent <head> and <body> sections.

{
    "html.format.indentInnerHtml": false,
}

Maximum number of line breaks to be preserved in one chunk. Use null for unlimited.

{
    "html.format.maxPreserveNewLines": null,
}

Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.

{
    "html.format.preserveNewLines": true,
}

Maximum amount of characters per line (0 = disable).

{
    "html.format.wrapLineLength": 120,
}

Wrap attributes.

{
    "html.format.wrapAttributes": "auto",
}