fralau/mkdocs-macros-plugin

Custom variable in title/level 1 not expanded in top/title bar

sverdoux opened this issue · 3 comments

Forwarding from squidfunk/mkdocs-material#5608

Context

environment:

Python 3.8.5 Win64

mdx_truly_sane_lists==1.2
mkdocs==1.3.0
markdown==3.3.7
mkdocs-macros-plugin==0.7.0
mkdocs-material==8.3.4
mkdocs-material-extensions==1.0.3
mkdocs-include-markdown-plugin

Using the following config file and sample markdown structure:

mkdocs.yml
site_name: "Test doc"
site_url: "http://localhost"

repo_name: test
edit_uri: ""
docs_dir: "test"
site_dir: "test_site"
use_directory_urls: false

theme:
  name: 'material'
  palette:
    - scheme: default
      toggle:
          icon: material/toggle-switch-off-outline
          name: Dark mode
    - scheme: slate
      toggle:
          icon: material/toggle-switch
          name: Light mode
  features:
    - navigation.instant
    - navigation.indexes
    - navigation.top
    - toc.integrate
nav:
  - Main:
    - 'index.md'
    - Sub:
      - 'sub/index.md'

extra:
  custom_var: 'Custom name'

markdown_extensions:
  - admonition
  - pymdownx.b64
  - pymdownx.highlight
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.mark
  - pymdownx.details
  - mdx_truly_sane_lists
  - attr_list
  - pymdownx.caret
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.snippets
  - md_in_html

plugins:
  - include-markdown
  - search
  - macros
test/index.md
# h1 with custom variable {{custom_var}}

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

# Other h1

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text
test/sub/index.md
---
title: title with custom variable {{custom_var}}
---

# h1 with custom variable {{custom_var}}

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

# Other h1

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Some sample text

Bug description

Serving the provided project with mkdocs does not expand custom variables in the title bar when scrolling down to the first section of pages:
image
image

Maybe It is simply not supported or I'm using it wrong, but I was wondering if it could be fixed ?
I could simply use the text manually without a variable but in our main project we try to put variables everywhere we can as some names are repeated all over the places in various pages level 1 header.
Variables can't be used in the mkdocs nav section (I think) so I don't really want to use the setp of 1 of the following priorities for title page: https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data
And as I describe it here steps 2 and 3 seems to not work with custom variables.

Thanks !

Related links

Reproduction

gh-mkdocs.zip

Steps to reproduce

  1. mkdocs serve -a 0.0.0.0:8900 -f mkdocs.yml
  2. browser to http://localhost:8900/index.html
  3. scroll down

Browser

Chrome, Firefox

Welcome to this project and thank you!' first issue

Possible duplicate of:

fralau commented

Thanks. You can follow up on #144