Skip to content

Reusable Text Snippets #22

@goldfishlaser

Description

@goldfishlaser

We need to add functionality to create, manage, and insert live-linked reusable text blocks into documents to reduce duplication and maintain consistency across documentation.

NOTE: This list of requirements is a draft and feedback is welcome. One might argue that storing in categories and folders shouldn't be included in an MVP for example and nested is more important.

Functional Requirements (DRAFT):

I. Snippet Creation & Management

A) Users can create new snippets with a unique name/identifier and text content
B) Users can edit existing snippets
C) Users can delete snippets
D) Users can store snippets in categories/folders
E) Users can create, rename, and delete categories/folders
F) Users can move snippets across categories/folders
G) Snippets are stored persistently {TBD: Snippets are defined in a configuration file (e.g., .snippets.json or snippets/ directory with individual files? or something else?)}

II. Snippet Insertion

A) Documents should store snippet references (e.g., snippet ID) not the actual content
B) Visual indicator uses contrast to distinguish snippet content from regular text (e.g., icon of some sort)
C) If a user deletes a snippet that's in use but not the reference ("orphaned references"), remove cleanly.

III. Snippet Discovery

A) Users can view a list of all available snippets
B) Users can search and filter snippets by name or content

IV. Out of Scope for initial implementation

A) Nested snippets (unless we can handle circular references)
B) Variables/Parametrization (e.g. {{user.name}}
C) Confirming before deleting snippets in use
D) Fancy Insertion Methods, such as

  • Option 1: IntelliSense/autocomplete triggered by a character (e.g., @, #, or /);
    • User types trigger character followed by search term;
    • Dropdown shows filtered list of matching snippets with category context;
    • Arrow keys to navigate, Enter to insert
  • Option 2: Keyboard shortcut (e.g., Ctrl+K Ctrl+S) opens quick-pick menu;
    • Searchable/filterable list of all snippets;
    • Shows category hierarchy;
    • Supports fuzzy search;
  • Option 3: Browsing method:
    • Sidebar tree view panel;
    • Hierarchical view of categories/folders and snippets;
    • Click snippet to insert at cursor position;
    • Right-click context menu for snippet management (edit, delete, duplicate)

D) Snippet Details (where and when snippets are in use)
E) Preview snippet before insertion

PS BTW, personally, I like to handle images as snippets so... that would be next.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions