class

Markdown::File

Inherits Reference < Object

A class representing a Markdown file

Constructors

new(sources : Hash(String, String), base : Path)

Initialize the post with proper data

Source

Instance methods

<=>(other : File)
Source
_replace_shortcodes(text : String) : String
Source
base

Reader used for canonical ordering of parallel-read posts

Source
date
Source
dependencies

List of all files and kv store items this post uses

Source
fallback?(lang = nil) : Bool

True when the content shown for lang comes from another language's source file (only possible when content fallback is enabled)

Source
has_language?(lang : String) : Bool

Whether this post exists for the given language (it always does when content fallback is enabled)

Source
has_teaser?(page_html : String, lang : String)
Source
has_teaser?(lang = nil)

Check if this post has a teaser (uses <!--more--> or summary metadata)

Source
html(lang = nil)

The rendered HTML for this file, memoized per language because computing it means a markdown compile plus a full HTML parse, and it is needed several times per post (html, summary, teaser).

Source
load(lang = nil) : Nil

Load the post from disk (for current language only)

Source
metadata(lang = nil)
Source
output(lang = nil)
Source
rendered(val, lang : String)

Render the fragment from an already-built value() context, so callers that also need the value (page title, breadcrumbs, language links) build it once per page

Source
rendered(lang = nil)

Render the markdown HTML into the right template for the fragment

Source
replace_shortcodes(lang)
Source
shortcode_dependencies(lang = nil) : Array(String)

kv:// inputs for the shortcode templates this post uses, so tasks that render it can declare them as dependencies

Source
shortcodes(lang = nil)
Source
show_updated?(lang = nil)

Check if the updated date should be shown (at least 1 minute different from post date)

Source
social_context(lang = nil)

Social-sharing metadata for this page (OpenGraph/Twitter cards): an explicit description from the frontmatter, falling back to a plain-text excerpt of the summary, and a preview_image (also accepts cover_image or image) for the card thumbnail.

Source
source(lang = nil)
Source
summary(page_html : String, lang : String)
Source
summary(lang = nil)
Source
taxonomies
Source
taxonomy_terms(lang = nil)
Source
template(lang = nil)

Path for the Templates::Template this post should be rendered with

Source
text(lang = nil)
Source
title(lang = nil)
Source
to_s(io)
Source
toc(lang = nil)
Source
value(lang = nil)

Return a value Crinja can use in templates

Source