crossnote icon indicating copy to clipboard operation
crossnote copied to clipboard

@import and absolute paths

Open dzackgarza opened this issue 5 years ago • 2 comments

It seems to be the case that @import command only works with relative paths/directories, is it possible to use absolute paths in some cases?

(Perhaps one easy fix would just be to check the first character of the path to see if it's "/".)

dzackgarza avatar Jun 13 '19 06:06 dzackgarza

Absolut Paths seem to work @import "/chapters/convex-analysis/KonvexeProbleme.md" in https://github.com/gabyx/TechnicalMarkdown works relative to the root folder of the workspace.

What does not work is

@import "file:///home/.../Desktop/Repository/TechnicalMarkdown/chapters/convex-analysis/KonvexeProbleme.md"

gabyx avatar May 21 '20 07:05 gabyx

@import should be able to handle Urls (only https:// is implemented) and relative "./bla" (relative to the source of the .md) and absolute file paths "/bla/bla" relative to the working/project directory of the engine. This is already implemented Maybe a replacement variable would be good such that behavior is predictable:

  1. @import "${workingDir}/..."
  2. @import "${basePath}/...."
  3. @import "${currentFile}/..."
  4. @import "/..." -> same as 2.
  5. @import "./..." -> same as 3.

So far your request works. I would prefer that other urls file:// is also supported such that we can reference any path on a disk locally...

gabyx avatar May 21 '20 07:05 gabyx