-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
When calling %%writefile cell magic disable syntax highlighting #1447
Comments
Good point, we should do that for most |
In this case you could use |
Oh, is this function as recent addition to CM ? |
I'm not sure when it was added, but we're using it in JupyterLab: https://github.com/jupyter/jupyter-js-ui/blob/master/src/codemirror/index.ts#L24 |
As a question, how difficult would it be to make it so that should ever the file type of %%writefile be a CSV, then the text is justified to align to commas? This would visually present CSV files very well, and double as an intuitive way to input data. |
I'm not sure exactly what options codemirror provides, but I'd guess that would be pretty hard. Have a look at handsontablejs for a (prototype) way to edit data frames in the notebook - it works with pandas data frames, but they can easily load from and save to CSV. |
Yeah, I thought it would be non trivial. Do you think it would be worth me attempting a plugin that simply adds spaces before commas to pad out the csv for alignment? Or would that also be non trivial? I haven't played around with plugins before. I'll give handsontablesjs a try. Thanks for the tip. |
Unfortunately the handsontablesjs method won't work for my purpose. I have been specifically requested to have a permanent record of everything used to make the model within the notebook. Hence writing the CSV file directly into the notebook. |
We have an idea we're planning to develop that we call 'editor plugins' - i.e. alternative interfaces to write/edit the contents of a cell. A data entry table would make perfect sense in that system, so you might want to keep an eye out for that functionality. It should, I hope, get implemented in the next few weeks. |
Ahh brilliant. Thank you. Will do. One great feature currently available is that I can drag and drop a csv file from the file browser directly into the cell and it fills it out as expected. Would a custom data entry table plugin stop something like that from working? |
I'm surprised that works at present, actually 😕 . A custom editor plugin should be able to handle drop events, though, so it should work with that. |
Brilliant. Would the custom editor plugin be able to activate only if certain text is within the cell? And would this maybe work like "tabs" above a cell? Essentially if the plugin is active, and then "%%writefile (*).csv" gets written at the top of a cell, then a data entry tab would appear. Might the set up be something like that? |
I just realised you would probably use the metadata dropdown box... |
The UI hasn't been worked out, but that's roughly the idea - there'll be some way to switch between the table view that the plugin provides and the raw code that it translates the table into. |
Wonderful. Do you know anyone else who is looking to make a data table type editor with the new plugin method? See if I can work together with them. |
Not yet, but I imagine that once support for editor plugins is implemented, there will be other people who'd want to work on a data table editor with you. |
@takluyver @blink1073 @gnestor : is this functionality available now? thanks! |
@takluyver What's the status of this? Is this something that we should revisit at the team meeting this week? |
The original issue of disabling syntax highlighting for |
Ya, it sounds like editor plugins require a much larger discussion. Ok, I will take a crack at disabling syntax highlighting for |
This might be worthy of opening another issue, but i've noticed that when using |
That's expected. You might be able to use a Python variable like |
I bump into the same issue, using a variable doesn't really help... for example setting variable f Is there any reason why the filename has to be litteral rather than using standard string syntax? |
UsageError: Cell magic |
When calling the %%writefile cell magic python syntax highlighting continues. This can be quite confusing for people who are being shown the notebook and reading the code for the first time.
An example of what I mean can be seen here:
http://mybinder.org/repo/Simonbiggs/electroninserts_bundle/electroninserts_notebook.ipynb#Recording-and-loading-the-data
The text was updated successfully, but these errors were encountered: