add raw_mimetype metadata to raw cells#4306
Conversation
There was a problem hiding this comment.
Great, at the time of writing this, I did not notice to write it inherited from HTMLExporter instead of a more basic one... less code to maintain 👍
|
@minrk a general question... do we have plans to make the metadata of raw cells available to the user in a simpler way? Currently it is exposed through the CellToolBar, but not easy to modified for final user... or this PR is related to the change of the notebook format (I did not read yet)? Or, I am missing some things, which is the most probably ;-) |
|
@damianavila I think raw cells should get their own toolbar for setting the raw format type, I will be looking into that today. |
|
ok, thanks for the info! |
|
+1 |
|
As discussed yesterday, do you want to use mimetype instead of 'html','python',... ? |
I'm not entirely sure - mimetype is better for machines, but humans don't really want to type them, and the only way to specify format right now is to edit raw metadata, which means typing it all out. I'll look into a toolbar for raw cells that might alleviate that. |
|
isn't the raw_format/raw_formats a little too much ? I guess it's for convenience, but I'm worried it willl be too complicated for user. why not just stick with |
|
raw_format is used for the default value. I guess I could replace that with raw_formats[0], but that would raise if anyone does |
There was a problem hiding this comment.
Given the strong connotation of the work "output" in the context of the notebook (to mean the output of running code), I don't think this word change makes sense. What is the problem with "Raw Text"?
There was a problem hiding this comment.
We have proof that "Raw Text" is confusing to people, perhaps because it is simply not accurate.
A raw cell is always raw nbconvert output (html, rst, latex, etc. - it is never plain text).
Many people interpret 'Raw Text' as 'Unformatted Text', aka <pre>, which is totally sensible based on the label. But this is not what Raw Cells are. Raw Cells are, by definition, raw nbconvert output.
Obviously, there is some ambiguity between Code Cell output and nbconvert output, but I think Raw Output is less confusing than Raw Text. Do you have a better alternative? Should we be extremely explicit and label them raw nbconvert output, since that is what they are?
There was a problem hiding this comment.
I agree that "Raw Text" is confusing.
A good fraction of notebook users never touch nbconvert. For those users,
the phrase "nbconvert output" means little, if anything. Even in the
context of nbconvert, calling this output is confusing. It is really input
from a user that nbconvert passes through unmodified to its output.
In the notebook UI, it is in fact plain, unformatted, unrendered text.
What about the following. In the Notebook UI, we refer to these in a way
that reflects their usage in the Notebook UI - maybe Unrendered Text? If
we want to stick with the output idea, I do think that "Raw nbconvert
output" is better though.
This also makes me think that one of the metadata values for these cells,
in addition to html, rst, latex, should be verbatim/pre. In that case it
would simply dump the content of the cell into a pre if html or verbatim if
latex. But maybe that violates the pass-through aspect of these cells.
On Wed, Oct 9, 2013 at 3:07 PM, Min RK notifications@github.com wrote:
In IPython/html/templates/notebook.html:
@@ -126,7 +126,7 @@
We have proof that "Raw Text" is confusing to people, perhaps because it
is simply not accurate.
A raw cell is always raw nbconvert output (html, rst, latex, etc. - it
is never plain text).Many people interpret 'Raw Text' as 'Unformatted Text', aka
, which
is totally sensible based on the label. But this is not what Raw Cells are.
Raw Cells are, by definition, raw nbconvert output.Obviously, there is some ambiguity between Code Cell output and nbconvert
output, but I think Raw Output is less confusing than Raw Text. Do you have
a better alternative? Should we be extremely explicit and label them raw
nbconvert output, since that is what they are?—
Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/pull/4306/files#r6872554
.
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com
There was a problem hiding this comment.
What about something like 'raw inclusion'?
There was a problem hiding this comment.
What about something like 'raw inclusion'?
I like that...
There was a problem hiding this comment.
Or "nbconvert passthrough"
There was a problem hiding this comment.
I prefer raw inclusion, but at the end, any of the last ones will work, I think...
There was a problem hiding this comment.
I would like us to find a name that reflects how these are handled in the
notebook UI, not just nbconvert.
On Fri, Oct 11, 2013 at 8:43 AM, Damián Avila notifications@github.comwrote:
In IPython/html/templates/notebook.html:
@@ -126,7 +126,7 @@
I prefer raw inclusion, but at the end, any of the last one will work, I
think...—
Reply to this email directly or view it on GitHubhttps://github.com//pull/4306/files#r6918597
.
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com
There was a problem hiding this comment.
That seems odd to me. Their role in the notebook UI doesn't seem important, given that the entire point of the cell is a place to dump nbconvert output. For instance, totally hidden (maybe toggle on/off) raw cells makes perfect sense from a UI perspective, since they are guaranteed to not have any function in the live notebook.
|
FYI, need rebase. |
|
Yes, and I need to cleanup the cell toolbar code, so I can get a toolbar on just one type of cell. |
|
inching closer on this one. I have the raw format cell toolbar mostly working. |
There was a problem hiding this comment.
empty branch in one condition ?
There was a problem hiding this comment.
haven't written the dialog yet, still need to do that.
|
Except one comment the js/css part seem ok. haven't read the rest though. |
|
This need a rebase ... Sorry. |
select based on raw_format metadata key if defined. Default behavior is to include raw cells of unspecified format (consistent with existing behavior).
sets their values in resources
make hierarchical rather than either/or. Also, don't use the same class name for the outer and inner css classes.
and make sure cell_type is defined *before* calling TextCell.apply
- in toJSON - don't clobber existing value in Cell constructor
|
rebased, and the toolbar now only displays on the raw cells. The metadata key is |
There was a problem hiding this comment.
Instead of "restructuredText" I would use "reST"... so the dropdown menu would be narrowed.
|
I tested a little bit and I like... again 👍 I just added some minor comments. |
|
@minrk would you like to respond to @damianavila comment ? Or should we modify that in later PRs ? |
|
I'll tweak it to be more generic. The way the code works, I don't think it would be worth the effort to make placeholder support variation. |
|
restructuredtext->rST in selector so it can be narrower. |
|
Great! Thanks for addressing the comments |
reduces width
add raw_mimetype metadata to raw cells
|
Great ! Thanks ! |
add raw_mimetype metadata to raw cells
allows exclusion in nbconvert based on format. If no format is specified, a raw cell is included by default (matches current master behavior).
and adds Raw Cell cell toolbar