rosscdh / mkdocs-markdownextradata-plugin

A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
MIT License
84 stars 17 forks source link

referencing issue when using nested mkdocs #38

Open ukpatel08 opened 2 years ago

ukpatel08 commented 2 years ago

I'm working on a project where I have nested mkdocs. See the tree below.

|--sw_docs
    |--mkdocs.yml
    |--docs
        |--index.md
   |--doc1
       |--_data
           |--ref1.yml
           |--ref3.yml
       |--mkdocs.yml
       |--docs
           |--index.md
   |--doc2
       |--mkdocs.yml
       |--_data
           |--ref2.yml
       |--docs
           |--index.md

At the top level mkdocs.yml I have the following

  site_name: my site

  plugins:
     -search
     - markdownextradata:
         data: doc1/_data, doc2/_data

When I build the info from ref1 gets picked up but info from ref2 does not.

so {{ ref1.name }} correctly links in the first document. But I get an error when trying to use {{ ref2.name }} in the second document. If I use {{ ref1.name }} in the second document then no issue.

I'm using the mkdocs-monorepo-plugin to have a layered site. I'm also using the mkdocs-with-pdf plugin to create individual PDFs of doc1 and doc2. This is the primary reason why I have ref1 and ref2 defined.

currently, my only solution is to duplicate ref1 and ref2 at the top level.

Do I have my top-level mkdocs.yml setup correctly? Or is what I'm trying to do is currently not possible?