pub enum Shortcode {
Subscribe(SubscribeShortcode),
Buttons(ButtonsShortcode),
Gallery(GalleryShortcode),
Hero(HeroShortcode),
Grid(GridShortcode),
Recent(RecentShortcode),
Apply(ApplyShortcode),
}Expand description
A typed shortcode block.
Variants:
Shortcode::Subscribe— inline subscribe form (description + button)Shortcode::Buttons— list of action buttons with markdown linksShortcode::Gallery— image gallery with optional column countShortcode::Hero— full-width hero section with media + overlayShortcode::Grid— flexible multi-cell layoutShortcode::Recent— recent-posts query with fallback markdownShortcode::Apply— inline apply / membership-request form
Phase B migrations add one variant per commit.
Variants§
Subscribe(SubscribeShortcode)
:::subscribe — inline newsletter signup form.
Configuration is via attributes (placeholder, button); body
must be empty under the unified grammar. Description text and
any framing prose live in the surrounding markdown.
Buttons(ButtonsShortcode)
:::buttons {.classname} — list of action buttons.
Body is one markdown link per line ([text](url)). The first
button gets the primary class; subsequent buttons get secondary.
Optional {.classname} extra classes attach to the wrapping div.
URLs flow through Url::Unresolved at parse time;
crate::ast::visit::visit_urls_mut (or src-tauri’s
apply_typed_shortcodes) classifies them into Url::Resolved
before rendering. The resolver-bypass class is closed by
construction: RenderHooks::render_shortcode reads Url::Resolved,
so a missing visitor is a debug-time crash.
Gallery(GalleryShortcode)
:::gallery N {.classname} — image gallery with optional columns.
N (positional integer) sets --moss-gallery-columns CSS variable.
Body is one image reference per line: , bare
path.jpg, or path|attrs for media attributes (passed through
to the renderer’s inline style).
Hero(HeroShortcode)
:::hero {image=path} — full-width hero section with media + overlay.
New grammar: image attribute carries the path. Backward-compat:
when image is absent, the extractor scans the first non-empty
body line for a media reference (![[path]], , or
bare media filename).
The pipeline hoists the rendered hero HTML into the article template’s hero slot — it does NOT render inline.
Grid(GridShortcode)
:::grid {cols=N} or :::grid N — flexible multi-cell layout.
Cells are split on +++ (new grammar) or --- (legacy moss-releases
backward-compat — Step 3 of #613 rewrites these to +++). Each cell
stores its raw markdown source; the renderer is responsible for any
nested-shortcode extraction and markdown processing per cell.
Recent(RecentShortcode)
:::recent since=... last=... count=... — list of recent posts
scoped to the page’s top-level folder (its scope).
Body (between the opening and closing :::) is reserved for
fallback content rendered when the query returns zero matches.
Empty body means no fallback (the shortcode renders nothing).
Apply(ApplyShortcode)
:::apply — inline membership/contributor application form.
Posts to the moss-seta /apply endpoint with fields email,
matters, publish, scope, and website (honeypot).
Configuration is via attributes (placeholder, button); body
must be empty. One-of {matters, publish} is server-enforced.
Succeeds terminally (no auto-revert) via data-revert="false".
Implementations§
Source§impl Shortcode
impl Shortcode
Sourcepub fn kind(&self) -> ShortcodeKind
pub fn kind(&self) -> ShortcodeKind
Return the ShortcodeKind of this shortcode.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Shortcode
impl<'de> Deserialize<'de> for Shortcode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Shortcode
impl StructuralPartialEq for Shortcode
Auto Trait Implementations§
impl Freeze for Shortcode
impl RefUnwindSafe for Shortcode
impl Send for Shortcode
impl Sync for Shortcode
impl Unpin for Shortcode
impl UnsafeUnpin for Shortcode
impl UnwindSafe for Shortcode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.