PhoenixBlog.Web.BlogComponents (phoenix_blog v0.1.7)

Copy Markdown View Source

Components for rendering Editor.js blog content as HTML.

Summary

Functions

Extracts a plain-text excerpt from a post's Editor.js body.

Functions

extract_excerpt(post, max_length \\ 150)

Extracts a plain-text excerpt from a post's Editor.js body.

Returns the first paragraph's text, stripped of HTML tags and truncated.

iex> extract_excerpt(post)
"This is the beginning of the post..."

iex> extract_excerpt(post, 100)
"Shorter excerpt..."

render_editor_blocks(assigns)

Attributes

  • blocks (:list) (required)