How do I create a language node?

Create a gist like this one, then submit its id in the form above. (Be sure to name it languageNode.json)

What do all the languageNode.json properties mean?

  1. category:

    The category property can be used to target a widget to a specific category of queries. For example, if the category is set to "math" the widget will only appear for queries performed under the math category, and if the category is set to "main" the widget will only appear for queries from the main page.

    Categories can also be used to make language nodes that help other widgets parse queries. For example, someone could make a "square" language node in the "shape" category so a drawing widget can parse "draw a square".

  2. components:

    The components define the way the language node will try to parse queries. This is best explained via example:

    A language node that parses queries of the form "population of [country] since [year]" might have a components array like this:

    ["population of ", {"category": "countries"}, " since ", {"regex":"\\d{4}"}]

    Components can be strings, regular expressions, or categories.

  3. url:

    This is the url of the web content you want to display in your widget.

    When a widget is displayed it is provided with a "interpId" url parameter that can be used to get the (multi-)parse tree. For an example, take a look at the plot widget here.

    If you don't want to host your widget, you can include it in your gist in a "index.html" file. (Be sure there is no url property in that case.)

Language nodes may include arbitrary additional properties. These can be useful for adding annotations to the parse tree. For example, attaching coordinates to language nodes in the "shape" category could make it easier to create shape drawing widgets since the widgets wouldn't need to know about all the different shapes, they could do all their drawing based on the coordinates.