Skip to content

Searching front-matter of all docs #64

Answered by fralau
bradumbaugh asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks. 👍

Yes you probably could write such a macro! Here are a few pointers.

You could write a main.py program (in the top directory of your project), with a function that scan sthe yaml files in the docs directory (env.conf['docs_dir'] should contain its (relative) name; unless you are sure it's called docs)

It could then read all YAML headers .

define_env(env):
    """
    This is the hook for defining variables, macros and filters

    - variables: the dictionary that contains the environment variables
    - macro: a decorator function, to declare a macro.
    """

    @env.macro
    def link_to(key:str) -> str:
          """Finds a doc that has a matching key in its front-matter, and…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@fralau
Comment options

@bradumbaugh
Comment options

@fralau
Comment options

@bradumbaugh
Comment options

@fralau
Comment options

Answer selected by bradumbaugh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
useful tip A how-to, good to know
2 participants