pathtoroot
.pathtoroot granularity:{RootGranularity = RootGranularity.PROJECT} -> StringRetrieves the relative path to the root of the file system. The root of the file system is determined by the working directory of either the project or the current subdocument, depending on the specified granularity.
If set to RootGranularity.PROJECT, the root is the parent directory of the target file being processed by the quarkdown compile command. If set to RootGranularity.SUBDOCUMENT, the root is the parent directory of the current subdocument file.
For example, consider the following file tree:
My-Project/
├─ main.qd
├─ file.txt
├─ subdocuments/
├─ subdocument.qd
├─ file.txt
├─ utils/
├─ example.qdIf main.qd invokes .pathtoroot, the result is . regardless of the granularity, since the working directory is the root of the project.
Consider the content of example.qd:
.read {.pathtoroot/file.txt}
.read {.pathtoroot granularity:{subdocument}/file.txt}Now, assume main.qd invokes .include {utils/example.qd}. Regardless of the granularity, the .pathtoroot calls in example.qd return .., so that My-Project/file.txt is correctly accessed by My-Project/utils/example.qd through the relative path ../file.txt.
Assume now that subdocument.qd is a subdocument and invokes .include {../utils/example.qd}.
With RootGranularity.PROJECT, the
.pathtorootcalls inexample.qdreturn.., so thatMy-Project/file.txtis accessed byMy-Project/utils/example.qdthrough the relative path../file.txt.With RootGranularity.SUBDOCUMENT, the
.pathtorootcalls inexample.qdreturn../subdocuments, so thatMy-Project/subdocuments/file.txtis accessed byMy-Project/utils/example.qdthrough the relative path../subdocuments/file.txt.
Return
a string value of the relative path to the root of the file system
Parameters
Throws
if the relative path cannot be determined