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

disable docutils #188

Open
slavkoja opened this issue Jun 22, 2017 · 5 comments
Open

disable docutils #188

slavkoja opened this issue Jun 22, 2017 · 5 comments

Comments

@slavkoja
Copy link

Hi,

i tried your SW (1.2.0) and it seems to work, but when i want to see my Sphinx's repo i have problem to see the Sphinx's RST files. The Sphinx itself uses superset of docutils directives, then not all files can be rendered by docutils. On these files klaus give me traceback and returns 500 (Internal server error). The traceback itself is not important, because the docutils errors are expected (some simple pages are rendered OK).

Please, make using particular renderer as optional, eg. by disabling it via command line, or allow renderer to fail, with failback to display of the plain/highlighted source.

@jonashaag
Copy link
Owner

You can simply uninstall docutils for the time being.

To fix the bug, if rendering fails, we should show the raw markup plus a warning.

@slavkoja
Copy link
Author

Uninstalling docutils is not solution, it is installed, because it is needed.

Warning can be logged, not need to be shown.

@jonashaag
Copy link
Owner

Sounds good! PR welcome :-)

@slavkoja
Copy link
Author

I see now, that klaus has not logging enabled, but solving render error is trivial (i am sorry, no PR):

--- highlighting.py.bak	2017-06-22 18:04:33.170205010 +0200
+++ highlighting.py	2017-06-22 18:27:23.421068022 +0200
@@ -85,7 +85,11 @@
     :param ctags_baseurl: base url used for source code hyperlinks, str
     """
     if render_markup and markup.can_render(filename):
-        return markup.render(filename, code)
+        try:
+            return markup.render(filename, code)
+        except Exception as err:
+            # continue on any rendering error
+            print ("WARNING: Markup rendering fails for %s (%s)" % (filename, err))
 
     try:
         lexer = get_lexer_for_filename(filename, code)

@jelmer
Copy link
Contributor

jelmer commented Jun 17, 2018

I think warnings should at the very least also be disabled to the web page. In many cases, whoever runs codehosting is not the person that writes the rst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants