artifact_detail
Single-artifact detail view composing metadata fields and a markdown body section.
const INDENT
const INDENT: &str = " ";Indentation prefix for detail rows.
const LABEL_PAD
const LABEL_PAD: usize = 9;Fixed padding width for field labels.
struct Component
pub struct ComponentRenders the full detail view for a single artifact, including metadata and optional body content.
| Field | Type | Description |
|---|---|---|
body |
Option<String> | Markdown body, rendered between content and closing rules; None leaves the section out. |
created |
Option<String> | Created timestamp as display text; set only in tests, None hides the row. |
id |
String | Full artifact ID; the header shows its first 8 characters. |
id_prefix_len |
usize | Number of highlighted characters in the ID header; 2 by default. |
notes |
Vec<NoteView> | Notes listed under a notes rule, in the order they were added. |
tags |
Vec<String> | Tag labels for the tags row; the row is hidden when empty. |
title |
String | Artifact title for the title row. |
updated |
Option<String> | Updated timestamp as display text; set only in tests, None hides the row. |
Implements Display.
Component::new
pub fn new(id: impl Into<String>, title: impl Into<String>) -> SelfCreate a detail view for the artifact with the given id and title.
| Parameter | Type | Description |
|---|---|---|
id |
impl Into<String> | the full artifact ID |
title |
impl Into<String> | the artifact title |
| returns | Self | The view, with no body, tags or notes and a 2-character ID prefix. |
Component::archived
pub fn archived(self) -> SelfMarks this artifact as archived (currently unused in detail rendering but kept for API compat).
| Parameter | Type | Description |
|---|---|---|
| returns | Self | The view unchanged. |
Component::body
pub fn body(self, body: impl Into<String>) -> SelfSets optional markdown body content to render below the metadata fields.
| Parameter | Type | Description |
|---|---|---|
body |
impl Into<String> | the markdown source |
| returns | Self | The view with the body set. |
Component::id_prefix_len
pub fn id_prefix_len(self, len: usize) -> SelfSets the number of highlighted prefix characters in the artifact ID.
| Parameter | Type | Description |
|---|---|---|
len |
usize | the prefix length |
| returns | Self | The view with the new prefix length. |
Component::note
pub fn note(self, id: impl Into<String>, body: impl Into<String>) -> SelfAdds a note to the detail view.
| Parameter | Type | Description |
|---|---|---|
id |
impl Into<String> | the full note ID |
body |
impl Into<String> | the note text |
| returns | Self | The view with the note appended. |
struct NoteView
struct NoteViewA note attached to the artifact, as the detail view shows it.
| Field | Type | Description |
|---|---|---|
body |
String | Note text, shown as one plain value with no markdown rendering. |
id |
String | Full note ID; its first 8 characters are shown. |