Allow snippets to reference files from project root
See original GitHub issueFor project documentation with deeply nested pages it would be helpful to support referencing files using absolute paths which resolve against for example the project root.
An example from Akka HTTP docs:
file: /docs/src/main/paradox/scala/http/common/http-model.md
## Instead of:
@@snip [ModeledCustomHeaderSpec.scala](../../../../../../../akka-http-tests/src/test/scala/akka/http/scaladsl/server/ModeledCustomHeaderSpec.scala) {
## Use the following:
@@snip [ModeledCustomHeaderSpec.scala](/akka-http-tests/src/test/scala/akka/http/scaladsl/server/ModeledCustomHeaderSpec.scala) {
The root could be configurable via the SBT plugin. The main downside is that links won’t be “GitHub friendly”.
The alternative is to not nest documentation files inside src/main/paradox
but instead in for example /docs/
and example source code somewhere other than /docs/src/main/scala
.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Add relative directory/filepath support to snippets · Issue #37570
Currently, snippets allow you to resolve the current directory or filepath with TM_DIRECTORY and TM_FILEPATH respectively.
Read more >Snippets in Visual Studio Code
New Snippets file for ' '... option in the · Preferences: Configure User Snippets dropdown menu and are located at the root of...
Read more >How to refer to files relative to project root in deployment of a ...
I have a very similar situation. The post-deployment script includes another sql file using the sqlcmd :r "..\..\Another.sql".
Read more >Snippets API - GitLab Docs
Snippets API operates on snippets. Related APIs exist for project snippets and moving snippets between storages. Snippet visibility level.
Read more >Walkthrough: Create a code snippet - Visual Studio (Windows)
Test your snippet by opening a C# or Visual Basic project. With a code file open in the editor, choose Snippets > Insert...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We use the GitHub friendly feature in our internal docs that also use paradox, not to mention that I can effortlessly jump from the markdown doc to the snippet doc in my editor (yes emacs does that).
If you think the nesting is too deep, then just redefine the sbt setting
sourceDirectory in paradox := "/path/to/nirvana"
.I was mainly thinking of the sanity of developers maintaining the Akka HTTP documentation, and completely understand the hesitation to break editors and other tools.
Personally, I like the idea of documentation coexisting with each project. So another possibility would be to see if Paradox files can somehow be moved into each subproject thus make linking easier. This way examples would also naturally be part of the subproject’s test code.