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

Support PathLike objects in base_path #2206

Merged
merged 3 commits into from
Oct 27, 2023
Merged

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Oct 14, 2023

This enables this usage in MkDocs (note that specifying as a list already works):

  - pymdownx.snippets:
      base_path: !relative $docs_dir

Currently you get an error:

               self.base_path = [os.path.abspath(b) for b in base]
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           TypeError: 'DocsDirPlaceholder' object is not iterable

This enables this usage in MkDocs (note that specifying as a list already works):

```yml
  - pymdownx.snippets:
      base_path: !relative $docs_dir
```

Currently you get an error:
```
               self.base_path = [os.path.abspath(b) for b in base]
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           TypeError: 'DocsDirPlaceholder' object is not iterable
```
@gir-bot gir-bot added S: needs-review Needs to be reviewed and/or approved. C: snippets Related to the snippets extension. C: source Related to source code. labels Oct 14, 2023
@facelessuser
Copy link
Owner

We would need tests to confirm that things are working with PathLike objects.

@gir-bot gir-bot added the C: tests Related to testing. label Oct 14, 2023
@facelessuser
Copy link
Owner

Can you enable check_paths to make sure that portion works as well?

@facelessuser
Copy link
Owner

Hmm, it may not be necessary to enable check_paths. I looked over the code again and it seems we test the file's existence whether it is enabled or not, check_paths just raises an error if the file is not found. Since the test demonstrates the inserted content is there, we can assume it is checking and finding things as needed.

@oprypin
Copy link
Contributor Author

oprypin commented Oct 27, 2023

So does anything need to be changed? I understood this as probably not?

@facelessuser
Copy link
Owner

No, I think it is fine, thanks for checking back in.

@facelessuser
Copy link
Owner

@gir-bot lgtm

@gir-bot gir-bot added S: approved The pull request is ready to be merged. and removed S: needs-review Needs to be reviewed and/or approved. labels Oct 27, 2023
@facelessuser facelessuser merged commit f4a66a6 into facelessuser:main Oct 27, 2023
13 checks passed
@oprypin oprypin deleted the patch-1 branch October 28, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: snippets Related to the snippets extension. C: source Related to source code. C: tests Related to testing. S: approved The pull request is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants