Comments (5)
The template doesn't look at the code of the cell at all, it just puts it all in a .. code:: python
block (this is also wrong - it should match the language the notebook is written in).
You could write a custom template which would look at cell magics and produce appropriate rst directives. I think this would probably be useful for us too, now that we're converting notebooks into rst docs.
from nbconvert.
On Jun 20, 2015, at 01:23, Thomas Kluyver [email protected] wrote:
The template https://github.com/jupyter/nbconvert/blob/master/nbconvert/templates/rst.tpl#L10 doesn't look at the code of the cell at all, it just puts it all in a .. code:: python block (this is also wrong - it should match the language the notebook is written in).
You could write a custom template which would look at cell magics and produce appropriate rst directives. I think this would probably be useful for us too, now that we're converting notebooks into rst docs.
And what if you pass relevant option to the first line that are necessary for the comprehension of the program ?
Moreover magic are βjustβ syntactic sugar for actual function call as hist -t shows.
from nbconvert.
It seems like there are two pieces to this issue, one part should be fixed (it should put the language the notebook is written in not .. code:: python
as @takluyver points out) and the other would seem to require a level of code parsing beyond templating that, based on what @takluyver and @Carreau are saying, is not on the roadmap.
The former should be dealt with for 5.0, the latter maybe no_action (or wishlist if it is something we plan to implement) is that right?
I'm going to open a new issue for dealing with the former, and mark this as no_action.
from nbconvert.
One possibility for the latter part is that we could specify the language as IPython, relying on our own lexers to deal with highlighting magics. I don't know how well they do currently with cell magics using other languages.
from nbconvert.
Closing as there's no action taken and the complexity of the change is questionable.
from nbconvert.
Related Issues (20)
- execute a notebook without a file extension, the notebook_name will lose the last character
- Image Size in PDF
- Implement mermaid rendering with `--to pdf`
- Enable Scrolling for Outputs not Maintained in HTML Export
- webpdf JSONDecodeError: Expecting value: line 1 column 2 (char 1)
- Compatibility with pandoc version on ReadTheDocs HOT 3
- 'state' KeyError when calling `html_exporter.from_notebook_node`
- RFE: please drop use `bleach` because it is deprecated HOT 2
- Error: `403 : Forbidden The error was: '_xsrf' argument missing from GET` on JupyterHub >= 4.1 HOT 3
- problem with --to html and --to pdf
- Problem with WebPDF in a conda environment
- TagRemovePreprocessor.remove_cell_tags for empty tags
- X.jupy.org
- Convert error .ngscript to .html
- lxml_clean_html dependency issue in nbconvert lower version (6.5.1)
- nbconvert for python 3.9 crashing during the templateexporter.py
- Encountered problems pip installing at two different levels.
- Update mermaid to v10.9.1 HOT 2
- Poetry and nbconvert dependency resolution (ModuleNotFoundError: No module named 'attrs')
- Template Not Found: Unable to locate base.tplx or other built-in LaTeX templates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbconvert.