prettier

package
v0.3.1001 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCommand

func DefaultCommand() string

DefaultCommand returns the default prettier command appropriate for the current shell.

func Element

func Element(name string, typeAttrValue string, content string, depth int, prettierCommand string) (after string, err error)

func IsAvailable

func IsAvailable(command string) bool

func Run

func Run(input, fileName, command string) (formatted string, err error)

Run the prettier command with the given input and file name. $TEMPL_PRETTIER_FILENAME is set to the file name being formatted. To format blocks inside templ files a fake name is provided, e.g. format.html, format.js, format.css etc. The command is run in a shell, so it can be a complex command with pipes and redirections.

Examples:

prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
prettierd --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
npx prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
prettier --config ./frontend/.prettierrc --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL