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
Support the include directive on GitHub #1088
Comments
|
Is there any way to preprocess include directives? i.e. a project with these files: // foo.adoc
foo// bar.adoc
bar// README.pre.adoc
include::foo.adoc
include::bar.adocAnd running something like this: $ asciidoctor <some magic flag> README.pre.adoc -o README.adocWill generate a file named foo
barIs this a thing that exists? |
|
Indeed. I wrote a coalescer script and put it in the extensions-lab repository. See https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb Does that suit your needs? This might be nice to have either as an cli in Asciidoctor or as a separate project. |
|
This is fantastic, thanks @mojavelinux. |
|
What are the issues with the way the include directive currently works and GitHub's security requirements? It is hard to make any useful suggestions in the absence of that background. My use is for including fragments of some of my source files (.c, .cpp, .frag, .vert, etc.) in docs such as tutorials that are describing the code. I would really like to not have to manually regenerate documents anytime the code changes. Could the coalescer script be run in a push hook on GitHub or would that violate their security requirements too? |
|
Any updates on this? |
|
While I absolutely agree that not having the include directive on GitHub is a huge pain, there is at least one approach that makes it somewhat workable. What you do is have a CI job come through an run a script that expands include directives so you get something like this in the file afterwards: The part inside of (Once the 1.5.6 upgrade happens, you can reduce the ifndef clause to a single line). Again, this is far from ideal, but at least it would allow you to leverage the include directive and still have it display properly on GitHub. But you would need to set up an automated task that expands the include files in place. |
That's definitely allowed and exactly what I had in mind. |
|
What if to implement a limited I know that including any file can be a security problem, but including other asciidoc files that are rendered the same way should not be a problem. Github is rendering any single asciidoc file anyway, why not to render asciidoc inside asciidoc?🤔 |
|
The custom include processor enables us to do that exactly. The problem we're currently dealing with is that GitHub has not yet shown a willingness to discuss this. I am ready for that conversation any day. |
|
Any change this might be implemented in near future? |
|
This is not something we have any control over. It's up to GitHub to enable it. We've given them the code. Now it's on them to enable it. See github/markup#1095 |
We'd like to find a way to support includes on GitHub in a way that works within the boundaries of the security requirements. This issue is intended to plan for and track the progress on this upstream request.
The text was updated successfully, but these errors were encountered: