PhoenixKit.Modules.Publishing.PageBuilder.Parser (phoenix_kit v1.7.42)

Copy Markdown View Source

Parses .phk (PhoenixKit) XML-style markup into an AST.

Example input:

<Page slug="home">
  <Hero variant="split-image">
    <Headline>Welcome to PhoenixKit</Headline>
    <Subheadline>Build faster with {{framework}}</Subheadline>
    <CTA primary="true" action="/signup">Get Started</CTA>
  </Hero>
</Page>

Output AST:

%{
  type: :page,
  attributes: %{slug: "home"},
  children: [
    %{
      type: :hero,
      attributes: %{variant: "split-image"},
      children: [
        %{type: :headline, content: "Welcome to PhoenixKit"},
        %{type: :subheadline, content: "Build faster with {{framework}}"},
        %{type: :cta, attributes: %{primary: "true", action: "/signup"}, content: "Get Started"}
      ]
    }
  ]
}

Summary

Functions

Parses .phk XML content into an AST.

Functions

parse(content)

@spec parse(String.t()) :: {:ok, map()} | {:error, term()}

Parses .phk XML content into an AST.