Skip to content
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

.rst render #211

Open
boarpig opened this issue May 27, 2014 · 34 comments
Open

.rst render #211

boarpig opened this issue May 27, 2014 · 34 comments
Assignees
Labels
🎯 feature Categorizes as related to a new feature ☁️ plugin Maybe one day, who knows

Comments

@boarpig
Copy link

boarpig commented May 27, 2014

I installed your official linux x64 binary on my desktop and set it up to use sqlite. Then as a first thing I tried migrating my github repo

https://github.com/boarpig/issue

but it seemed to load forever. It seems it cloned it fine but cannot open the page for it. I suspected it could be something with the size of the repository but cloning gogs repository works fine.

Then I wondered if it was the name of the repo "issue" but I tried making a copy with a different name but that didn't seem to work either. There's something wrong with that repository, that makes gogs load forever and not even give any sort of error.

@unknwon
Copy link
Member

unknwon commented May 27, 2014

Thanks for your feedback, let me test it first.

@unknwon unknwon added Bug and removed Undetermine labels May 27, 2014
@unknwon
Copy link
Member

unknwon commented May 27, 2014

The clone is actually finished, it's the problem that somewhat cannot open the repository. @slene do you have any idea?

@unknwon
Copy link
Member

unknwon commented May 27, 2014

@slene It's the infinity loop in code block https://github.com/gogits/gogs/blob/master/routers/repo/repo.go#L184-L234 , if I directly type single file URL, I can view normally.

@boarpig
Copy link
Author

boarpig commented May 28, 2014

Problem actually seems to be in markdown rendering for Readme.md file in base.RenderMarkdown, so perhaps there is a bug in the markdown renderer or and error in my readme file that your renderer cannot handle
EDIT: I just noticed that the readme is not markdown at all, it's reStructuredText that python documentation required for submission in pypi. I totally forgot that. Github handles that transparently but gogs tries to render it as markdown

@boarpig
Copy link
Author

boarpig commented May 29, 2014

Do you think I should open a new issue with correct description since it turned out that the problem is not really the cloning of the repo but markdown render engine going in to infinite loop for some reason since the readme is not markdown but restructured text?

@unknwon
Copy link
Member

unknwon commented May 29, 2014

@boarpig Sorry for delay, I've read your comment but forgot to reply.

I think you can just change the title of issue would be fine!

@unknwon
Copy link
Member

unknwon commented May 29, 2014

BTW, is rst is some doc format? I'm not familiar with it. Also you have .rst extension, which means we cannot render it for now, and it should be problem of checking what README to render.

@unknwon
Copy link
Member

unknwon commented May 29, 2014

I'll do some research see if Go has some parser for .rst, otherwise, I'll make one. Thanks for your valuable feedback!

@unknwon unknwon assigned unknwon and unassigned slene May 29, 2014
@boarpig
Copy link
Author

boarpig commented May 29, 2014

Yes, restructured text is a text document format very similar to markdown but predates it by few years. It's very used in python documentation and you need to have your readme in rst format in order to submit your project into python package index so it's more convenient for me to only have one readme in rst instead of having them in markdown and rst

Here's a reference

@boarpig boarpig changed the title Cannot open a cloned repository Markdown renderer hangs trying to parse non-markdown README May 29, 2014
@unknwon
Copy link
Member

unknwon commented May 29, 2014

Thanks for your info. I'll take a look tonight.

@unknwon
Copy link
Member

unknwon commented May 30, 2014

https://github.com/demizer/go-rst seems like half-work done for parsing but not rendering to HTML. I currently check the extension for not rendering .rst by markdown parser. Which makes server works but shows raw data of your .rst, kind of ugly...

unknwon added a commit that referenced this issue May 30, 2014
@boarpig
Copy link
Author

boarpig commented May 30, 2014

Both rst and markdown are designed to be readable even as pure ascii so that shouldn't be a problem. I much rather take unrendered rst than not being able to use the server. Thanks a lot, Unknwon.

@unknwon
Copy link
Member

unknwon commented May 30, 2014

@boarpig no problem, I asked author of https://github.com/demizer/go-rst and that does not work yet, so it may take some times to get a time to write a rst parser.

@unknwon unknwon added the Future label May 30, 2014
@boarpig
Copy link
Author

boarpig commented May 30, 2014

Would it be possible, that when ever the readme is not rendered, it would be monospace font and follow the newlines like it was ascii fine instead of html.

That would make most any readme look fine without rendering

@unknwon
Copy link
Member

unknwon commented May 30, 2014

Definitely possible.

@unknwon unknwon changed the title Markdown renderer hangs trying to parse non-markdown README .rst render Sep 1, 2014
@unknwon unknwon added Feature and removed Bug labels Sep 1, 2014
@theY4Kman
Copy link

Any news on this feature?

@unknwon unknwon modified the milestones: 0.7.0, 0.6.13 Aug 29, 2015
@unknwon unknwon modified the milestones: 0.7.5, 0.7.0 Sep 18, 2015
@unknwon unknwon modified the milestones: 0.7.5, 0.8.0 Nov 15, 2015
@unknwon unknwon modified the milestone: 0.9.0 Dec 13, 2015
@kvinwang
Copy link

如果暂时找不到完美的go rst渲染引擎,能否实现一个扩展机制:
可以通过配置,让特定的文件类型交由另一个http server来渲染。这样,我们就可以用Python来实现渲染后端,也能保证完美的语法兼容性。

支持rst期待已久,希望早日实现。

@unknwon
Copy link
Member

unknwon commented Jan 15, 2016

@LoongW sounds workable...

@unknwon unknwon added this to the 0.10.0 milestone Jan 15, 2016
@unknwon unknwon removed this from the 0.10.0 milestone Feb 7, 2016
@unknwon unknwon added the ☁️ plugin Maybe one day, who knows label Mar 15, 2016
@nithinphilips
Copy link

Agreed with @LoongW. Hugo does something similar for alternative markup formatting. For rst, They basically execute rst2html and read the STDOUT.

Here's the hugo method that implements the rst rendering:
https://github.com/spf13/hugo/blob/5d3705df16014c1404282234e30ef9d1c9be9c15/helpers/content.go#L488

rst2html is installed as part of the docutils package and can output HTML from rst input.

This is an easy way to support markup languages that do not yet have a Go implementation.

@BoboTiG
Copy link

BoboTiG commented Apr 23, 2016

👍

@sluedecke
Copy link

This is related to #2097 and an external renderer might be a solution for both.

@lenisko
Copy link

lenisko commented Jul 12, 2016

Would be great to have support for it

@vorlif
Copy link

vorlif commented Aug 2, 2016

+1

2 similar comments
@ngulden
Copy link

ngulden commented Sep 3, 2016

+1

@Red-Li
Copy link

Red-Li commented Sep 8, 2016

+1

@tboerger
Copy link
Contributor

tboerger commented Sep 8, 2016

Please use the builtin +1 function, it's annoying to receive such useless emails

@lannocc
Copy link

lannocc commented May 26, 2017

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:

https://github.com/AlphaGriffin/gogs

@kb-1000
Copy link

kb-1000 commented Apr 8, 2018

You could also try calling the docutils API via https://github.com/sbinet/go-python

@JamesTheAwesomeDude
Copy link

@kaeptmblaubaer1000 and @LoongW's suggestions both sound awesome.

I really like the idea of actually linking in to an "authoritative" library (provided there's not too much performance impact, to get that beautiful canoncal parsing), but honestly even just some FastCGI-style hack sounds like it wouldn't really lock us in too much, and in the meantime provide an immensely effective workaround until this is supported fully.

@jakedp
Copy link

jakedp commented Nov 14, 2018

Why not just display it as text? Instead of looking for some complicated solution there must be a simple one in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 feature Categorizes as related to a new feature ☁️ plugin Maybe one day, who knows
Projects
None yet
Development

No branches or pull requests