Documentation
¶
Overview ¶
Package slug converts human-readable titles into URL-friendly slugs for journal filenames.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanTitle ¶
CleanTitle normalises a title for storage in YAML frontmatter.
Replaces newlines, tabs, and consecutive whitespace with single spaces, trims the result, and strips the "..." truncation suffix that entity.Session.FirstUserMsg may carry.
Parameters:
- s: Raw title string
Returns:
- string: Cleaned title string
func SlugifyTitle ¶
SlugifyTitle converts a human-readable title into a URL-friendly slug.
Lowercases the input, replaces non-alphanumeric characters with hyphens, collapses consecutive hyphens, trims leading/trailing hyphens, and truncates on a word boundary at journal.TitleSlugMaxLen characters.
Parameters:
- title: Human-readable title string
Returns:
- string: Slugified string (may be empty if input is empty or all punctuation)
func TitleSlug ¶
TitleSlug returns the best available slug for a session, following a fallback hierarchy:
- existingTitle: enriched title from previously exported frontmatter
- s.FirstUserMsg: first user message text
- s.Slug: Claude Code's random slug
- s.ID[:8]: short ID prefix
The chosen source (except s.Slug and s.ID[:8], which are already slugs) is passed through SlugifyTitle.
Parameters:
- s: Session to derive the slug from
- existingTitle: Title from enriched YAML frontmatter (may be empty)
Returns:
- slug: URL-friendly slug for the filename
- title: Human-readable title for the H1 heading (empty when falling back to s.Slug or s.ID)
Types ¶
This section is empty.