Snippets not rendering. #1185
-
Hi. I have two files currently where I'm using snippets (more planned for future). The only difference is the location of the snippet file. In the first case, I didn't try to organize and just left the file in the docs folder, so the following syntax rendered perfectly: In the second file I did the following things to try to get it to work b/c I wanted to start organizing my files:
I've tried every formatting angle I could think of too (spacing) based on what I've read - and still nothing. Here's the different combinations I've tried: --8<-- docs/ux-reference/exceptions-table.md --8<-- --8<-- ../ux-reference/exceptions-table.md --8<-- --8<-- ux-reference/exceptions-table.md --8<-- --8<-- "ux-reference/exceptions-table.md" --8<-- --8<-- --8<-- --8<-- "../ux-reference/exceptions-table.md" --8<-- "docs/connectIntelliJ.md" Sharing the output here so you can see the output isn't working. I assume I'm missing something here ... but not sure what ... Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Just adding an additional update. I tried the syntax (again) that worked in the first (successful) file, with the folder inside the docs folder, and suddenly it did work ... Understanding exceptions data--8<-- "ux-reference/exceptions-table.md" |
Beta Was this translation helpful? Give feedback.
-
@spinningrachel, my issue with trying to answer your question is that it could be failing for any number of reasons. I would need to have a reproducible example. Do you have a public repo where you are experiencing this issue? Or can you create a simplistic public example? If I recall correctly, Snippets will just not show the block at all if it doesn't find the path, it shouldn't render the blocks if they are there, unless you have something like trailing whitespace after the markers...I'd have to see the source and your setup of Snippets to understand. On a side note. I'm not aware of their being any issue with using the following over and over:
But, personally, if I was using block format, I'd probably just combine them:
or use the single line format
|
Beta Was this translation helpful? Give feedback.
-
@facelessuser Thanks for getting back to me so fast! I only included loads of snippets to try to figure out which one would work - since it wasn't working and I thought it was me ... so to speak. Now I'm rendering a third page with a third snippet. This snippet, like the first that was successful, is in the docs folder. So the file referencing the snippet is docs/x.md and the snippet is docs/y.md for example. And yet, it's not rendering ... It's all very strange. This is my syntax in the file referencing the snippet: Command line arguments--8<-- "cli-manage-agentconfig.md" The correctly rendered file is: The two files that do and then don't render correctly are: The repo is here: Really appreciate your help, your advice, and your awesome extensions. |
Beta Was this translation helpful? Give feedback.
-
One of the issues I'm seeing is the fact that you are not referencing your snippets properly. For instance, consider this example:
It should be:
Why is this wrong? Because snippets looks at all files relative to whatever you have configured as your base path via the You might assume that your current working directory is That is the main issue I'm seeing from what is currently in your repository. |
Beta Was this translation helpful? Give feedback.
-
This is looking less like a bug and more like a user understanding issue. I'm going to move this issue to discussions and we can further discuss there. |
Beta Was this translation helpful? Give feedback.
-
@facelessuser just wanted to say thanks for the guidance, and indeed i'll continue to communicate here in Discussions as questions arise.👍🏽 |
Beta Was this translation helpful? Give feedback.
One of the issues I'm seeing is the fact that you are not referencing your snippets properly.
For instance, consider this example:
It should be:
Why is this wrong? Because snippets looks at all files relative to whatever you have configured as your base path via the
base_path
option. I see you have not set this option, so the default is.
.You might assume that your current working directory is
docs
when using mkdocs, but it is not, it is the root of your project where you are running mkdocs from. So to access files indocs
you have provide a path relative fro…