- From: Robin Berjon <robin@berjon.com>
- Date: Fri, 23 Sep 2016 11:03:30 -0400
- To: Jos de Jong <wjosdejong@gmail.com>
- Cc: Peter Krautzberger <peter.krautzberger@mathjax.org>, "public-mathonw." <public-mathonwebpages@w3.org>
On 22/09/2016 14:51 , Jos de Jong wrote:
> @Robin can you elaborate a bit on your idea? Do you mean that it would
> be trivial to translate a math formula into plain JavaScript which then
> can be evaluated, or to SVG for rendering? Or both?... Do you have
> concrete use cases in mind?
The way JSX works is that you can use markup in your code, like this:
let foo = <button>ohai!</button>;
That's pretty simple to type out, but obviously to make it useful what
you get out of it is not a string but a data structure. You can then
proceed to manipulating that data structure, injecting it into a DOM,
rendering it to string, etc. You can also embed code, variable, etc,
inside of it, say:
function listPeople (people = [], listType) {
return (
<ul className={listType}>
{
people.map(p => <li>{p.name}</li>)
}
</ul>
);
}
To be clear, I am not suggesting that this should be a major constraint
on the design. But I think it's worth keeping in mind the ability to
have the syntax as something that could be used as a plugin in a
JavaScript transpiler (this is not a very strong constraint, basically
it mostly needs to be disambiguatable from the surrounding context).
What gets returned could be manipulated (eg. you could feed it into a
library to execute it) or it could be rendered.
It's just a thought :)
--
• Robin Berjon - http://berjon.com/ - @robinberjon
• http://science.ai/ — intelligent science publishing
•
Received on Friday, 23 September 2016 15:03:55 UTC