mbr-markdown-browser 0.5.1

A fast, featureful markdown viewer, browser, and (optional) static site generator
{% set asset_base = relative_base | default(value="/.mbr/") %}
{% include "_head.html" %}
    {# HLJS and KaTeX CSS are now loaded dynamically by mbr-hljs and mbr-katex components #}
    {# When editing is enabled, idle-prefetch the (large) editor chunk so clicking
       the pencil opens instantly. Low priority; only on edit-enabled markdown pages. #}
    {% if edit_enabled %}<link rel="prefetch" href="{{ asset_base }}components/mbr-editor.min.js" as="script" crossorigin />{% endif %}
    {% if type and type == "person" %}<link rel="prefetch" href="{{ asset_base }}components/mbr-genealogy.min.js" as="script" crossorigin />{% endif %}
    {% if tags %}
        {% if tags is string %}
    <meta name="keywords" content="{{tags}}" data-pagefind-filter="tag[content]" />
        {% else %}
    <meta name="keywords" content="{{tags | join(sep=', ')}}" data-pagefind-filter="tag[content]" />
        {% endif %}
    {% elif keywords %}
        {% if keywords is string %}
    <meta name="keywords" content="{{keywords}}" data-pagefind-filter="tag[content]" />
        {% else %}
    <meta name="keywords" content="{{keywords | join(sep=', ')}}" data-pagefind-filter="tag[content]" />
        {% endif %}
    {% elif taxonomy.tags %}
        {% if taxonomy.tags is string %}
    <meta name="keywords" content="{{taxonomy.tags}}" data-pagefind-filter="tag[content]" />
        {% else %}
    <meta name="keywords" content="{{taxonomy.tags | join(sep=', ')}}" data-pagefind-filter="tag[content]" />
        {% endif %}
    {% endif %}
    {# No `| safe` on frontmatter values below: Tera autoescapes `.html`
       templates, and `| safe` would let a title like `</title><img >` emit
       live markup. An explicit `| escape` is equally wrong — autoescape runs
       after it, producing double-escaped `&amp;lt;`. #}
    <title>{{title_prefix | default(value="")}}{{title | default(value="")}}{{title_suffix | default(value="")}}</title>
    <meta name="title" content="{{title | default(value="")}}" data-pagefind-meta="title[content]" />
    <meta name="description" content="{{description | default(value="")}}" data-pagefind-meta="description[content]" />
    <meta http-equiv="last-modified" content="{{date | default(value="")}}" data-pagefind-sort="date[content]" />
    {# Every value below is JSON serialized and `<`/`>`/`&`-escaped server-side
       (see templates.rs::escape_json_for_script), so no frontmatter value,
       heading, file path or sibling URL can terminate this script block or
       break out of a string literal. `| safe` is required *because* the values
       are already script-safe — HTML entity escaping would corrupt them, since
       entities are not decoded inside <script>. #}
    <script>
      // Frontmatter available to page scripts (excludes rendered markdown for efficiency)
      window.frontmatter = {{ frontmatter_json | safe }};
      // Headings for table of contents
      window.headings = {{ headings_json | default(value="[]") | safe }};
      // Extended metadata
      window.extendedMeta = {
        wordCount: {{ word_count | default(value=0) }},
        readingTimeMinutes: {{ reading_time_minutes | default(value=0) }},
        fleschReadingEase: {{ flesch_reading_ease | default(value="null") }},
        fleschKincaidGrade: {{ flesch_kincaid_grade | default(value="null") }},
        filePath: {{ file_path_json | default(value='""') | safe }},
        modifiedTimestamp: {{ modified_timestamp | default(value=0) }},
        {% if prev_page %}prevPage: {{ prev_page_json | default(value="null") | safe }},{% endif %}
        {% if next_page %}nextPage: {{ next_page_json | default(value="null") | safe }}{% endif %}
      };
    </script>