-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update go-org & fix includes #6383
Conversation
Hugo has this concept of a virtual file system:
The first point may not be a deal-breaker, but I'm not thrilled about themes "poking around on my disk and including stuff". So what I suggest instead is that you instead of sending the filename, send in an "OpenFile |
Could you elaborate why you say theme? This is part of I understand the security concerns though and like the OpenFilefunc idea - could you give me some pointers on where I could get that from for access in |
When we, recently, introduced Hugo Modules, we added support for file mounts, including content from themes/theme components (including org files). As to "Open File" See https://godoc.org/github.com/gohugoio/hugo/helpers#PathSpec => https://godoc.org/github.com/gohugoio/hugo/hugolib/filesystems#BaseFs If you use the As to how to get that filesystem to where you need it, I'm not sure. I have plans on moving these "content renderer" into its own package once I add Goldmark. |
Thx! I got the BaseFS from page.pageCommon. Would you be fine something along this changeset? If so I'll add The current ReadFile allows relative includes by checking in the content FS first but falls back to trying to read the path relative to the project root. I guess that's a bad idea security wise so maybe we should just allow the content fs... |
- add support for latex fragments - allow customization of ReadFile method for includes (#+INCLUDE: ...)
The org mode renderer supports including other files [1]. We don't want to allow reading of arbitrary files (go-org defaults to ioutil.ReadFile [2]) but want to make use of the FileSystem abstractions hugo provides. For starters we will allow reading from the content directory only [1]: e.g. `#+INCLUDE: ./foo.py src python` includes `foo.py` as a python source block.
@bep ping. Ignore my last comment, I restricted it to just |
So, I don't see the security problem in reading files from the project root. We have plenty of examples of us doing that (there is even a But there are obvious benefits to having the files live in the standard Hugo folders:
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
see #6322
The org mode renderer supports including other files [1]. To resolve relative
paths we need the path of the current file - either absolute or relative to the
directory hugo is run from. DocumentName is the path relative to the content
directory, not the base directory that hugo is run from - we could get the full
path by looking up the content directory from the config and merging both; or
we just make the absolute path of rendered files available in the
RenderingContext.
[1]: e.g.
#+INCLUDE: ./foo.py src python
includesfoo.py
as a python sourceblock.