-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
External renderers and included files #6359
Comments
Could you have a similiar config with below? [markup.asciidoc]
ENABLED = true
FILE_EXTENSIONS = .adoc,.asciidoc
RENDER_COMMAND = "asciidoctor --out-file=- -"
; Input is not a standard input but a file
IS_INPUT_FILE = false |
This is in fact my current configuration (taken as is from here). |
@lunny Is there a way to pass |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Sorry to insist but the current way to integrate external renderers by using the standard input to feed them will not work for any renderer using other files from the project (for instance in case of document sources including project files). It seems to me that Asciidoctor is just an example among others. As Gitea is a collaborative project, I also totally understand that this issue cannot be resolved for now unless someone skilled enough has the time to handle it but I do not understand how closing automatically the issue will help. Am I the only one thinking that the current external renderer integration method cannot cover all use cases? |
Why don't you write a script that will set up the environment correctly for ascidoctor? You can send the stdin to a temporary file run ascidoctor on that or deal with the input file and then cat the output back out. |
@zeripath Are you saying that this script would be executed instead of asciidoctor and will hand the missing elements over to asciidoctor once it gathered all the missing pieces? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Interested as well in a solution to this problem. Including other files doesn't work with e.g. AsciiDoc which is unfortunate because it's a great feature. As such, our documentation cannot be properly viewed from Gitea. @gautaz Thanks for opening this issue ;) |
Also interested in solution for this... Can we fund this? |
I have the same issue, but for a different file format. If the external renderer could be passed the path to the git repository as a substitution or environment variable in RENDER_COMMAND, the rest could be handled outside of Gitea. Something like
would work fine. (Or if the user is running on Windows, they could use the %VAR% form for the command.) The external renderer would then be able to check out the necessary supporting files which are needed. |
OK. So I think the requirement is |
Let's make a sample. Assume we have a git directory in a repository like this.
Then I want to display the logo image in the HTML file if I enabled the third-party renderer for Is that you want? |
For my use case, the renderer needs to get at the git history to show summaries of what changed. So while this bug itself is about related files, I need to rummage around the git history. Hence my request for an environment variable (or command substitution) of a path to the repo. This would address both my use case (looking back in time), as well as this bug's request (finding supporting files). |
Just hit this one myself. :/ Bummer. How is the render executed? Is a checkout performed or does it pull the browser-requested file specifically from git? If the former, this should be fairly easy - just provide a RENDER_CMD directive in If the latter, however... it's not really possible, as gitea itself would need to be parser-aware of each markup language they wanted to support, which defeats the entire purpose of a "modular" system like it currently is designed to be. So I'd personally probably classify this as WONTFIX because I suspect it's impossible. For those needing a solution, however, how I've implemented this in the past is simply with a pre-commit hook that just renders to e.g. an HTML file (I'm a heavy user of Asciidoctor). Unfortunate that it then needs to be on every machine though. There are some proposed solutions (including setting |
Since you could do that in markdown with |
Markdown is not the only text markup out there. This bug was opened initially for Asciidoctor. |
We already have two environment could be used.
see https://docs.gitea.io/en-us/config-cheat-sheet/#markup-markup |
This comment was marked as outdated.
This comment was marked as outdated.
The root issue seems to be that when rendering external documents from standard input, the renderer has no idea how to find included resources. For example, Asciidoc includes allow rendering the content of the included document inline within the rendered document. When an asciidoctor command line utility starts rendering from stdin and encounters an Because stdin has no concept of file paths, the renderer fails (semi-gracefully) and renders the failure to include a requested file. It seems to me that rendering of documents needs to be extended to allow for external renderer to request documents (based on relative paths) as they process the rendering request. An example. Given two asciidoc files:
= README
include:doc/install.adoc[]
== Rendering
Use `asciidoctor` to render this document.
== Installation instructions
Install asciidoctor Then final rendering of the = README
== Installation instructions
Install asciidoctor
== Rendering
Use `asciidoctor` to render this document.
|
Recently I have successfuly configured app.ini to display included asciidoctor files, with some notes. Let said the ROOT_URL of gitea is Then
So the trick is to override And modify the related asciidoc files to have Let said
And
Adding prefix Repository visibility setting need to be set to non-private (under repo setting). Use of gitea user-token (https://token@domain) does not work for asciidoctor-renderer. |
That is a clever hack, but adding I've been playing around in my head with the idea of implementing a virtual filesystem inside gitea, serving content of the current repository commit directly from the git tree and using that for the asciidoctor, but I am no Go expert and I wouldn't know if that scheme would work with asciidoctor invocation at all. But if that would work, it would help tremendously with asciidoctor rendering. |
Gitea version 8670dec built with: bindata, sqlite
git version 2.15.3
[x]
):Description
Hello,
I'm currently using
asciidoctor
to render asciidoc readme files. These files contains include directives that the current process is unable to render correctly. The failure message displayed isUnresolved directive in <stdin> - include::filepath[]
My current understanding is that
asciidoctor
is unable to find the included file from the environment it is run within. This seems pretty obvious as the content to render is given through the standard input.Is there a way to circumvent this issue ?
What is the environment in which an external renderer is run within in order to produce the displayed markup ?
The text was updated successfully, but these errors were encountered: