On Tuesday, October 17, 2017 at 5:29:24 PM UTC-4, 黄祥 wrote: > > why web2py can't render the views in markdown format that been assign > (*.md) in most simple way? > e.g. > def testmd(): > response.view = 'default/testmd.md' > #response.render = 'default/testmd.md' > return locals() > > think about github pages can render it >
The web2py template engine does not do any specialized rendering of content outside the {{...}} delimiters. It processes the Python code inside the template delimiters and returns everything else as is. What you ask is simply not part of the design of the template system (nor most other template systems, I think). Of course, you can pass markdown content to a web2py template and have it rendered to HTML using a markdown-to-html converter. Or you can do the conversion in the controller and return the output directly rather than using a view. I'm not sure how Github Pages is relevant here. The issue is not a technical one (there are libraries to generate HTML from Markdown) -- this is already doable in web2py. It's just that the template system is not designed to do any special post-processing of the template content. Note, we couldn't add this functionality without breaking backward compatibility -- the framework can't start automatically assuming any view with a .md extension includes Markdown to be transformed to HTML (existing apps might be using the .md extension for some other purpose or be designed to return actual Markdown content). We could probably create a generic.md view that looks for a named view associated with the current requested function (perhaps with a different extension, such as .markdown), renders that view, and then converts it from Markdown to HTML. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.