Render/preview a single file?
erossi opened this issue · comments
Does it make sense for ssite to be able to preview a single file?
Currently:
ssite show ~/doc/file.md
[...]
NotADirectoryError: [Errno 20] Not a directory: 9
Thanks
E.
It's tricky to determine the document root for the file: in the case of ssite show ~/doc/file.md
, should it display file.html
in the site contained in doc/
, or doc/file.html
in the site contained in /home/erossi
, or similar for each combination of parents?
In theory if a user points to file.md
I could go up until I see a .git
and use that as the root, and if I don't find any I could use the directory that directly contains file.md
. Would that be reasonable?
The only risk that I see is that staticsite might end up serving more than needed if file.md
is not in a git repo, and there's a git repo in a parent directory. However show/serve by default serve only from localhost, so this is something that may unexpectedly disclose files to local users only.
Would that sound like a reasonable tradeoff?