Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YAML placeholder tags that resolve to current paths #3258

Merged
merged 3 commits into from
Jul 1, 2023
Merged

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Jun 11, 2023

- !relative  # Obtains the directory of the currently rendered Markdown file
- !relative $config_dir  # Obtains the directory of mkdocs.yml
- !relative $docs_dir  # Obtains the docs_dir
- !relative $docs_dir/some/child/dir

@oprypin oprypin force-pushed the dirtag branch 2 times, most recently from 53eac4e to f6dd3ac Compare June 12, 2023 11:35
@pawamoy

This comment was marked as resolved.

@oprypin

This comment was marked as resolved.

    - !relative  # Obtains the directory of the currently rendered Markdown file
    - !relative $docs_dir    # Obtains the docs_dir
    - !relative $config_dir  # Obtains the directory of mkdocs.yml
@oprypin oprypin marked this pull request as ready for review June 23, 2023 16:33
@oprypin
Copy link
Contributor Author

oprypin commented Jun 25, 2023

Tagging @facelessuser now also on the pull request for any comments. Now I actually mention pymdownx.snippets directly in docs.

@oprypin oprypin merged commit efe5bfb into master Jul 1, 2023
30 checks passed
@oprypin oprypin deleted the dirtag branch July 1, 2023 13:42
@squidfunk
Copy link
Sponsor Contributor

Could we allow plugins to register custom YAML tags? I suspect that this would need to be implemented outside of the plugin, because when the plugin is loaded, the configuration has already been parsed, but maybe plugins could provide something like a loader.py file that MkDocs checks and executes before parsing the configuration 😊

@oprypin
Copy link
Contributor Author

oprypin commented Aug 4, 2023

There's no clear technical solution how to do that (see also #3261), no known use case, and so no plan to do that

@squidfunk
Copy link
Sponsor Contributor

squidfunk commented Aug 4, 2023

It would be very helpful for the new projects plugin in Material for MkDocs to define tags to inline navigation from projects into the top-level site and other custom tags for additional features. From the top of my head: If a project defines an __init__.py or loaders.py next to mkdocs.yml, include that before attempting to parse the configuration.

That'll work, wouldn't it?

Edit: okay, the author would need to add the __init__.py then, which is odd. Hmm, is there really no way?

@oprypin
Copy link
Contributor Author

oprypin commented Aug 4, 2023

That sounds like not something that would require tags to function. Instead of - !foo bar you could just define - foo: bar or something. Feel free to open a discussion if you want to figure out a way to achieve something in the configs.

@squidfunk
Copy link
Sponsor Contributor

Thanks, I'll think a little about this and might open a dedicated discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for relative base_path in markdown_extensions
3 participants