On Mon, Nov 19, 2012 at 12:46 AM, Matthias BUSSONNIER <span dir="ltr"><<a href="mailto:bussonniermatthias@gmail.com" target="_blank">bussonniermatthias@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
> I mean, objects can define their own rich printing types in the notebook. Latex() renders LaTeX because it's output type is LaTeX. I am suggesting to create Markdown(), whose output type is markdown rendered text (if one does not already exist).<br>
<br>
</div>I understand better now.<br>
This could be a good project for json plugin.<br>
<div class="im"><br>
> And we are also working on having the ability to do<br>
><br>
> the value of x is ::x::<br>
> in a markdown cell,<br>
> where ::x:: will be replace by the actual repr of x in the kernel.<br>
> Still thinking on the best syntax and how to choose between tex/html/.../ repr.<br>
> --<br>
> Matthias<br>
><br>
> That would also work, though obviously for non-trivial string manipulations, it would be better to do it directly in code (for example, appending "s" to the end of a word iff a certain variable is greater than 1).<br>
<br>
</div>Good point.<br>
<div class="im"><br>
> Also, would this allow arbitrary code to be executed, or just variable names?<br>
<br>
</div>To make it work with any code could be done easily.<br>
Though I would like to avoid side effect, and nothing prevent you from precomputing part of the string in the previous code-cell.<br></blockquote><div><br></div><div>Arbitrary code vs. variables has nothing to do with side-effects. str(obj) (i.e., obj.__str__) already allows arbitrary code execution. I think it matters more from a parsing side, and also from a conceptual side. If you really want to avoid side-effects, you could require that the variable be a str. If you do that, you might even be able to do some smart caching to avoid additional calls to the kernel.</div>
<div><br></div><div>By the way, if x changes, would ::x:: update automatically, or only when the Markdown cell is "reexecuted"? If you want the former without side-effects, again you will want to restrict to str objects only.</div>
<div><br></div><div>Aaron Meurer</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888">--<br>
Matthias<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
</div></div></blockquote></div><br></div>