format

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package format renders file sizes and other journal metadata in human-readable form.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSessionLink(label, slug string, count int) string

FormatSessionLink formats a Markdown list item linking to a page with a session count.

Parameters:

  • label: Display text for the link
  • slug: Link target without .md extension
  • count: Number of sessions to display

Returns:

  • string: Formatted line (e.g., "- [topic](topic.md) (3 sessions)\n")

func FormatSize

func FormatSize(bytes int64) string

FormatSize formats a file size in human-readable form.

Parameters:

  • bytes: File size in bytes

Returns:

  • string: Human-readable size (e.g., "512B", "1.5KB", "2.3MB")

func KeyFileSlug

func KeyFileSlug(path string) string

KeyFileSlug converts a file path to a safe slug for use as a filename.

Replaces /, . with _ and * with x.

Parameters:

  • path: Original file path (e.g., "internal/config/*.go")

Returns:

  • string: Safe slug (e.g., "internal_config_x_go")

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL