mprivat / mkdocs-snippet-plugin

An mkdocs plugin that injects snippets from a file in a git repository
MIT License
12 stars 3 forks source link

Snippets from files inside mkdocs project #7

Open gaweCodes opened 2 years ago

gaweCodes commented 2 years ago

I can't find a way to reference a md-file inside the same mkdocs project. Is it possible to reference a file inside the same mkdocs project? How?

I would expect something like this:# Welcome to MkDocs {{ snippet('pathToFolderThatContainsTheFileInNextParam, 'README.md', '## Installation') }}

Of corse the path is relative to the bas_path inside the mkdocs.yml:

plugin
   - snippet:
      base_path: docs/pfad_zum_snippets_folder

The last param of the snippet-function above should be option, so that it will import the whole file. Is this already possible?

GDYendell commented 2 years ago

I would also appreciate this. Would you consider a PR to make the git clone separate/optional, or is that not the behaviour you want here? I imagine it could be based on whether the target has a git URL at the front.

@gaweCodes if you specifically want to include a whole file this may be suitable. However, like this plugin, you can't include a section of a file in the same repo.