Formatters

Pretty-print HTML, CSS, and SQL code.

Commands

These tools are primarily used in pipelines, but can be used via pipe:

echo "<div><p>hello</p></div>" | devv pipe exec "html-formatter"
echo "body{color:red;margin:0}" | devv pipe exec "css-formatter"
echo "SELECT * FROM users WHERE id=1" | devv pipe exec "sql-formatter"

Examples

# Format minified HTML
echo '<html><body><div class="main"><p>Hello</p></div></body></html>' | devv pipe exec "html-formatter"

# Format inline CSS
echo "body{margin:0;padding:0}h1{color:blue;font-size:24px}" | devv pipe exec "css-formatter"

# Format a SQL query
echo "SELECT u.name,u.email FROM users u JOIN orders o ON u.id=o.user_id WHERE o.total>100 ORDER BY u.name" | devv pipe exec "sql-formatter"

Pipeline Usage

Pipeline ID Description
html-formatter Pretty-print HTML
css-formatter Pretty-print CSS
sql-formatter Pretty-print SQL
devv pipe exec "html-formatter" "<div><p>test</p></div>"
devv pipe exec "css-formatter | base64-encode" "body{color:red}"

Behavior

All formatters transform their input — the formatted result passes to the next step.

Was this page helpful?