Packages

Reactive publishing framework, filesystem-based with support for Markdown, nested hierarchies, and instant content rebuilding. Written in Elixir.

Current section

Files

Jump to
pardall_markdown lib pardall_markdown content anchor_link.ex
Raw

lib/pardall_markdown/content/anchor_link.ex

defmodule PardallMarkdown.Content.AnchorLink do
@moduledoc """
Table of contents links. Stored into `PardallMarkdown.Content.Post.toc`.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary, autogenerate: false}
@foreign_key_type :id
embedded_schema do
field :title, :string
field :level, :integer, default: 1
field :parent_slug, :string
end
def changeset(model, params) do
model
|> cast(params, [
:id,
:title,
:level,
:parent_slug
])
|> validate_required([
:id,
:title,
:level,
:parent_slug
])
end
end