Inline variable insertion in markdown

Hmm, good question. I think this thread might be the best place for that, so that we maintain visibility and don’t segregate the conversation into one implementation?

@westurner makes a good point concerning shadowing existing syntax, even if it’s not a core feature. Given my thoughts about attachments & kernel outputs, I am strongly in favour of getting the syntax “right” for both of them at an early stage, even if we only deliver the kernel-variant to start with.

A small disclaimer: the following suggestions probably won’t quite work unmodified for polyglot kernels. Whilst I don’t use these myself, I don’t want to deny their ability to use this feature before it’s even ready for use! However, I don’t think we need to endorse any syntax in Jupyter Notebook itself - this can be done indirectly by defining Markdown extensions e.g. Notebook Cell-Type Generaliastion - #3 by chrisjsewell
Instead we’re settling upon reasonable single-kernel syntax that might become markdown-it-expression and markdown-it-attachment

I’ll offer up some suggestions:

Variant A

  • Kernel Injection: {{python `x` }}
  • Attachment Injection: {{ x }}

Variant B

  • Kernel Injection: ${{ x }}
  • Attachment Injection: {{ x }}

I prefer variant A, because embedding code inside single quotes is a natural idea, and it re-inforces the fact that this is an inline expression (i.e. not a block token). In both variants, we re-purpose the {{ }} syntax, though.