Surface.Formatter.Phases.TagWhitespace (surface v0.7.0) View Source

Inspects all text nodes and "tags" leading and trailing whitespace by converting it into a :space atom or a list of :newline atoms.

This is the first phase of formatting, and all other phases depend on it.

Link to this section Summary

Functions

Callback implementation for Surface.Formatter.Phase.run/2.

This function takes a node provided by Surface.Compiler.Parser.parse and converts the leading/trailing whitespace into Surface.Formatter.whitespace/0 nodes.

Link to this section Functions

Callback implementation for Surface.Formatter.Phase.run/2.

Specs

tag_whitespace(Surface.Formatter.surface_node()) :: [
  Surface.Formatter.surface_node() | :newline | :space
]

This function takes a node provided by Surface.Compiler.Parser.parse and converts the leading/trailing whitespace into Surface.Formatter.whitespace/0 nodes.