## 事象
[[Material for MkDocs]]で[[Snippets (PyMdown Extensions)|Snippets]]拡張の機能を利用し、スニペットファイルを相対パスで指定しても認識されない。
`docs/sample.md`
````markdown
```ts title="sample.ts"
--8<-- "./sources/sample.ts"
```
````
`docs/sources/sample.ts`
```ts
function hello() {
console.log("hello");
}
```
### 環境
| 対象 | バージョン |
| ----------------------- | ----------- |
| [[Ubuntu]] | 24.04.1 LTS |
| [[MkDocs]] | 1.6.1 |
| [[Material for MkDocs]] | 9.6.5 |
| [[PyMdown Extensions]] | 10.14.3 |
## 原因
[[Python Markdown]]のパーサーはファイルコンテキスト情報を持っていないため、スニペットを挿入したファイルからの相対パスを認識できないから。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://github.githubassets.com/favicons/favicon.svg" />
<span class="link-card-v2-site-name">GitHub</span>
</div>
<div class="link-card-v2-title">
[Feat]: Snippets support relative paths · Issue #1275 · facelessuser/pymdown-extensions
</div>
<div class="link-card-v2-content">
I'm not sure if you have context on the location of the file being parsed, but would it be possible to support s ...
</div>
<img class="link-card-v2-image" src="https://opengraph.githubassets.com/eb311d355aa37d4739c37bf8d199fb73190e2076fd98cda6b4e1b7219fbf3e7e/facelessuser/pymdown-extensions/issues/1275" />
<a href="https://github.com/facelessuser/pymdown-extensions/issues/1275"></a>
</div>
## 回避策
`base.path` を指定して、相対パスはそこからに統一する。
```yaml
markdown_extensions:
- pymdownx.snippets:
check_paths: true
base_path: docs
```