This repository contains the source code for:
Neo4j v5 - Cypher Cheat Sheet:
The Cypher Cheat Sheet is a replacement for the Cypher Refcard.
[.neo4j-ee.aura-dbe] (1)
==== (2)
[source, cypher, role=noheader] (3)
----
MATCH (n)
RETURN n AS node
----
[.description] (4)
-- (5)
Description
More description
--
====-
Add a role for each cheat-sheet that the example applies to. Leave blank if it applies in all cases.
-
Use an example block to contain the Cypher example and description.
-
Add an optional block for a Cypher example, specifying
[source, cypher,`role=noheader]. -
Add a required description block.
-
If the description consists of more than one paragraph of text, use an open block.
To apply a label and fitering to all examples on a page, add the required roles in the document header:
[.neo4j-ee.aura-dbe]
= Page titleasciidoc:
attributes:
page-cheatsheets: (1)
- name: 'Neo4j Enterprise Edition' (2)
label: 'Enterprise Edition' (3)
class: 'neo4j-ee' (4)
default: true (5)
- name: 'Neo4j Community Edition'
class: 'neo4j-ce'
- name: 'Deprecated'
class: 'deprecated'
label-only: true (6)-
Add a
page-cheatsheetssection to the playbook to define the different views that a user can choose from. In this example we’ve added two views: Neo4j Enterprise Edition and Neo4j Community Edition. -
Add a name for each view. This text is displayed in the dropdown that you use to select which Cheat Sheet you want to view.
-
[Optional] Add label text. When an example is not applicable in all views, a label is displayed to indicate which views it applies to. If no
labelvalue is specified, the value ofnameis used. -
Specify a class for each view. This is used to add a role to the example block. For example, the class
neo4j-eeis specified by[.neo4j-ee], and the classesneo4j-eeandaura-dbeby[.neo4j-ee.aura-dbe]. -
Specify a default view. This is the view that is displayed when the page is loaded.
-
If you want to display a label for some entries without that label appearing in the dropdown, you can use the
label-onlyattribute. In this example, entries that have the[.deprecated]role will have theDeprecatedlabel displayed, but 'Deprecated' is not an option you can select from the dropdown. In this preview build, bothConfigurationandDeprecatedhave been added aslabel-onlyviews.
To add a new section to the cheat sheet, create a new .adoc file, using the header to link to an appropriate section of the Cypher manual. For example, for modules/ROOT/pages/set.adoc:
= link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/clauses/set/[SET^]
Add the new section in the appropriate place in modules/ROOT/pages/index.adoc:
include::set.adoc[leveloffset=2]
In almost every case the way to add labels to examples is to follow the steps above.
You can, however, also add labels to the content by using the label: macro.
To add one or more labels to an example,add a [.labels] paragraph after the [.description] paragraph:
[.description] A paragraph describing the code [.labels] label:extra-label[Label text] label:another-label[More label text]
Note that these labels are displayed in the output, but do not affect whether an example is displayed or not.
The effect is that same as adding a label-only label, as described in Playbook configuration, so in most cases it is better to use that method.