Search documentation of phoenix_kit

# PhoenixKitWeb.Live.Modules.Blogging.PageBuilder.Parser (phoenix_kit v1.6.19)

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

parse(content)

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.