-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
External markup renderer [$15] #374
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
Comments
Depending on external tools for rendering content is not really our goal |
The default can be empty, then it's not a dependency and more like plugin interface. |
We could find a go lib to do that |
It seems there isn't any mature Golang library to do that. So maybe give a config like @plemp said, but default is closed currently. |
IMO adding external renderers isn't a bad idea, could be made with a simple list. Example:
given
would generate |
I would prefer to integrate a real plugin system instead of increasing the current config more and more |
Well I guess I'm just here to vote for .asciidoc the rich format and feature is offers have make it a defacto tools in our product chain. |
@tboerger maybe external renderer is better choice, because asciidoc is an extensible format. the renderer itself should have a plugin system. |
I recently did a quick-and-dirty hack on Gogs to add some basic .rst support for our own use, but maybe you will also find it useful: |
@lannocc great! I will try to merge it on v1.3 |
After #2525 merged, I will try to add reStructuredText support based on github.com/hhatto/gorst and https://github.com/AlphaGriffin/gogs. And I think that should be easy since that a new document type only implementation |
|
@plemp, It seems there is no golang lib to handle asciidoc well. don't know how to use |
Any update on this one? |
@lunny: Bountysource keeps telling me "Your application has been suspended" and throws various [1] via GitHub or |
@tantegerda1 OK. Thanks for your bounty. |
Getting this working was as simple as
However, what I am wondering is: isn't this a security nightmare*? How quick+easy would it be for some sufficiently clever person to monkey into existence a *—in a situation involving potentially untrusted users having write access to repositories |
@JamesTheAwesomeDude it is definitely a security problem in that situation. I wouldn't say it is a complete nightmare, however, because you can write a wrapper for your external renderer that takes one or more steps to isolate it from your server environment, e.g.:
You're still left with the problem of the returned html being untrusted, but you can at least prevent attacks on the external renderer(s) from being able to perform arbitrary actions on the server. |
@Shados Just to expand on that a bit, since But I really am concerned at the scarcity of documentation on this; as I mentioned before, you've got to manually hunt down the information yourself to make this work..I might have to stick something in the Wiki, maybe... Although, re:"the problem of the returned html being untrusted", It does look like Gitea (and Github itself, for that matter) actually sanitizes it pretty violently...for instance,
renders to the browser merely to:
with absolutely no styling at all, not even an indication that the word "Note" is a header for the following content, no indent for the note itself....anything (same with |
@JamesTheAwesomeDude yes, output from markup modules (external renderer included) are passed through a sanitizer in an attempt at solving that part of the problem. Of course, if you want the output to be useful, you would likely need to relax the sanitizer slightly to allow more class names (whatever ones your renderer is using), and then separately supply a manually-audited or created stylesheet that defines those classes. You're still left with two possible avenues of attack, however:
|
See gogs/gogs#211 and gogs/gogs#2097.
Most Python-related projects use reStructuredText
.rst
instead of markdown files, forREADME.rst
and documentation. Sometimes other markup languages are used, or markdown with extensions currently not supported by Gitea. GitHub supports the following markups: https://github.com/github/markup/.I propose the following feature:
If, for example, the file
README.rst
exists, its first 1024 bytes will be passed into stdin ofrst2html.py --no-raw
and stdout will be displayed as html for the file preview.An optional
%s
will be replaced by the matched file extension (so that one can write a script that handles both.rst
and.asciidoc
).As such a feature would be important to me, I am willing to implement this proposal, assuming there is a good chance it will be merged into master. Let me know if I can start working on it.
There is a $15 open bounty on this issue. Add to the bounty at Bountysource.
The text was updated successfully, but these errors were encountered: