How to create a GraphGist
You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page. Alternatively, you can put an AsciiDoc document in Dropbox and enter the public URL in the form.
This GraphGist shows the basics of using AsciiDoc syntax and a few additions for GraphGists. The additions are entered as comments on their own line. They are: //console for a query console; //hide, //setup and //output to configure a query; //graph and //table to visualize queries and show a result table.
Click on the Page Source button in the menu to see the source for this GraphGist. Read below to get the full details.
Define a Cypher query
[source,cypher] ---- CREATE (n{name:'cypher'})-[r:LIKES]->({name:'icecream'}) RETURN n.name, r ----
becomes:
CREATE (n{name:'cypher'})-[r:LIKES]->({name:'icecream'})
RETURN n.name, r
Queries are executed in the order they appear on the page during rendering, so make sure they can be performed in that order. If you have a setup query, it normally makes most sense to define it as the first query on the page. If it takes up too much space, hide it (see below for information on this). Each query has a green or red button to indicate if the query was successful or not. The console is set up after the executions, with an empty database, for the reader to play around with the queries.
There’s three additional settings you can use for queries. They all go as comments, on their own lines, before the query. The settings are:
|
Hide the query. The reader can still expand it to see it. Useful for long queries like setting up initial data. |
|
Initialize the console with this query. |
|
Show the output from the query. The output is always there, but this option makes it visible at page load for this query. |
Let’s try all the settings together, which means this query will be used to initialize the console, it will be hidden, and the raw output will be shown:
//hide //setup //output [source,cypher] ---- CREATE (n{name:'neo4j'})-[:LIKES]->({name:'complex data'}) RETURN n.name ----
which becomes:
The test run will always run the queries from top to bottom, so it usually makes sense to have the setup query as the first query. |
Show a graph visualization
The visualization is based on the database contents after the preceding query in the page.
//graph
becomes:
Show a result table for a query
This will show a result table for the preceding query.
//table
becomes:
Basic AsciiDoc formatting
|
Italic |
|
Bold |
|
|
Images:
Static images:
image::https://assets.neo4j.org/img/still/cineasts.gif[]
becomes
Dynamically generated image (using yUML):
image::https://yuml.me/diagram/scruffy/class/[Order]-billing%20%3E[Address%7Cname=hej],%20[Order]-shipping%20%3E[Address],[Order]-has%3E[Item][test]
becomes
Lists:
* Item 1 ** Item 1.1 * Item 2
-
Item 1
-
Item 1.1
-
-
Item 2
. First . Second
-
First
-
Second
Monospaced block: indent lines with one space.
Tables are well supported. See AsciiDoc Quick Reference for information on that and more.
Mathematical formulas
When using Math formulas, put them into a source block using LaTex syntax with \(
as a start delimiter.
The end delimiter is \)
.
The delimiters and the content between them should be placed in a AsciiDoc passthrough block without attribute substitution.
The formulas are rendered through MathJAX, supported commands are here.
[subs=none] ++++ \(ax^2 + bx + c \ne 0\) ++++
becomes
Below are some more examples.
2. \(ax^2 + bx + c \ne 0\)
4. \(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)
5. \(\sin^{-1} \theta\)
6. \(\int_a^b f(x)~dx\)
7.\(\sum\limits_{i=1}^n X_i\)
for more examples, see Some GraphGist Latex Examples
Is this page helpful?