question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow snippets to reference files from project root

See original GitHub issue

For 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:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bantonssoncommented, Sep 14, 2016

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".

0reactions
jonascommented, Sep 14, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found