Skip to content

Latest commit

 

History

History
119 lines (91 loc) · 3.98 KB

File metadata and controls

119 lines (91 loc) · 3.98 KB

docs-cheat-sheet

This repository contains the source code for:

Neo4j v5 - Cypher Cheat Sheet:

The Cypher Cheat Sheet is a replacement for the Cypher Refcard.

Asciidoc format

[.neo4j-ee.aura-dbe] (1)
==== (2)
[source, cypher, role=noheader] (3)
----
MATCH (n)
RETURN n AS node
----

[.description] (4)
--  (5)
Description

More description
--
====
  1. Add a role for each cheat-sheet that the example applies to. Leave blank if it applies in all cases.

  2. Use an example block to contain the Cypher example and description.

  3. Add an optional block for a Cypher example, specifying [source, cypher,`role=noheader].

  4. Add a required description block.

  5. 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 title

Playbook configuration

asciidoc:
  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)
  1. Add a page-cheatsheets section 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.

  2. 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.

  3. [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 label value is specified, the value of name is used.

  4. Specify a class for each view. This is used to add a role to the example block. For example, the class neo4j-ee is specified by [.neo4j-ee], and the classes neo4j-ee and aura-dbe by [.neo4j-ee.aura-dbe].

  5. Specify a default view. This is the view that is displayed when the page is loaded.

  6. If you want to display a label for some entries without that label appearing in the dropdown, you can use the label-only attribute. In this example, entries that have the [.deprecated] role will have the Deprecated label displayed, but 'Deprecated' is not an option you can select from the dropdown. In this preview build, both Configuration and Deprecated have been added as label-only views.

Adding a new section

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]

Additional labels

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.