GithubHelp home page GithubHelp logo

oprypin / mkdocs-same-dir Goto Github PK

View Code? Open in Web Editor NEW
34.0 3.0 2.0 56 KB

MkDocs plugin to allow placing mkdocs.yml in the same directory as documentation

Home Page: https://oprypin.github.io/mkdocs-same-dir

License: MIT License

Python 81.15% Shell 18.85%
mkdocs mkdocs-plugin

mkdocs-same-dir's Introduction

mkdocs-same-dir

Plugin for MkDocs to allow placing mkdocs.yml in the same directory as documentation

PyPI License GitHub Workflow Status

pip install mkdocs-same-dir

Usage

Activate the plugin in mkdocs.yml, along with actually changing docs_dir
(normally, MkDocs absolutely wouldn't let you set it to .):

site_name: foo
docs_dir: .
site_dir: ../site

plugins:
  - search
  - same-dir

and now you can move this mkdocs.yml into your docs directory, or move your docs alongside mkdocs.yml.

See example layout

Important notes

Another necessary effect of this plugin is that files directly at the root of the docs dir will no longer be picked up, unless they are Markdown files.

And note that the implementation of this plugin is a huge hack that monkeypatches MkDocs' internals. But I pledge to keep up with MkDocs updates and keep it working as long as that's still possible.

mkdocs-same-dir's People

Contributors

bilalshaikh42 avatar oprypin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mkdocs-same-dir's Issues

Ensure that CNAME file is copied into build

Hello,

Thanks for your work on this

I see from the readme that any files in the root won't be picked up except for markdown files. This prevents deploying to GitHub pages under a custom domain. Is there a way to ensure that the CNAME file is also picked up?

Feature request: Correct "edit this page" button when `repo_url` is set

The "Edit this page" button currently displayed on the generated docs page when repo_url is set in mkdocs.yml is not linking to the correct page when mkdocs-same-dir is in use.

Screenshot 2023-04-26 at 11 23 51 AM

For instance, if the URL is https://github.com/org/repo/edit/master/docs/README.md, the button currently links to https://github.com/org/repo/edit/master/README.md. This feature request is for the plugin to patch the button to link to the actual URL, instead of the one containing docs/.

If this is a desired feature, I can probably pull some time to work on it in the next few weeks.

Regression with mkdocstrings>=23.0.0 dependency

Hello, thanks for this wonderful plugin!

I noticed my doc builds started failing whenever mkdocstrings was upgraded to 0.24.0. If I upgrade this package in my environment, the same-dir plugin fails with the following message:

  File ".../mkdocs_same_dir/plugin.py", line 40, in _replace_validation
    config["docs_dir"] = os.path.join(config["docs_dir"], ".")
                                      ~~~~~~^^^^^^^^^^^^
KeyError: 'docs_dir'

Thought I'd report this here for now since I'm not sure how another plugin would interfere with this one. For now I simply pin mkdocstrings to 0.23.0

Plugin interfering with relative paths relative to --config-file

It appears that this plugin might be breaking the standard mkdocs behavior of evaluating paths in the config file relative to the file. If I do something like mkdocs build --config-file=docs/mkdocs.yaml, I get errors that my various configs don't exist:

ERROR   -  Config value 'theme': The path set in custom_dir ('docs/theme') does not exist.
ERROR   -  Config value 'watch': The path 'docs/theme/' isn't an existing file or directory.

The config file uses the relative path theme in both places, and the printed paths do exist relative to cwd.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.