ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Server
  • Cloud
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Download
ScyllaDB Docs ScyllaDB Sphinx Theme Examples Code blocks

Caution

You're viewing documentation for a previous version of ScyllaDB Sphinx Theme. Switch to the latest stable version.

Code blocks¶

Code block directives are for displaying code. By default the code is copyable and includes a copy icon. To keep code snippets neat, separate the display from the command. This keeps the command copyable without having the screen return inside the command.

Basic usage¶

For example using the rst code block before a restructuredText example:

.. code-block:: rst when used with the .. tip:: here's a tip as shown above, renders as:

.. tip:: here's a tip

The code block directive can be changed to a language which is supported by restructuredText. For example, the following code-block is cql. If you add the following code block directive, to the code sample below:

.. code-block:: cql

create_keyspace_statement: CREATE KEYSPACE [ IF NOT EXISTS ] `keyspace_name` WITH `options`

You see that there is syntax highlighting.

The key item to remember is that the entire code block needs three spaces before any line. The code will automatically be highlighted. You can create code-blocks in any of the following languages. Using none is also acceptable. If you use none, there is no syntax highlighting.

create_keyspace_statement: CREATE KEYSPACE [ IF NOT EXISTS ] `keyspace_name` WITH `options`

If you are including a large example (an entire file) as a code-block, refer to Literal Include.

Hide copy button¶

Add the class hide-copy-button to the code-block directive to hide the copy button.

For example:

.. code-block:: rst
   :class: hide-copy-button

   .. tip:: here's a tip

Renders:

.. tip:: here's a tip

Was this page helpful?

PREVIOUS
Collapse
NEXT
Glossary
  • Create an issue
  • Edit this page

On this page

  • Code blocks
    • Basic usage
    • Hide copy button
ScyllaDB Sphinx Theme
  • 1.7
    • 1.8
    • 1.7
    • 1.6
    • 1.5
    • 1.4
    • 1.3
    • 1.2
    • 1.1
  • Getting started
    • Toolchain
    • Installation
    • Quickstart
  • Configuration
    • Template options
    • Page options
    • Multiversion options
    • Markdown support
    • Redirects support
    • Search support
  • Commands
  • Deployment
    • Production deployment
    • Pull requests previews
  • Examples
    • Admonitions
    • Collapse
    • Code blocks
    • Glossary
    • Headings
    • Hero box
    • Includes
    • Images
    • Labels
    • Links
    • Lists
    • Panel box
    • Substitutions
    • Tables
    • Tabs
    • Text
    • TOC
    • Topic box
    • Versions
  • Upgrade guides
    • Migrating from 1.6 to 1.7
    • Migrating from 1.5 to 1.6
    • Migrating from 1.4 to 1.5
    • Migrating from 1.3 to 1.4
    • Migrating from 1.2 to 1.3
    • Migrating from 1.1 to 1.2
    • Migrating from 1.0 to 1.1
    • Migrating from 0.x to 1.0
    • Changelog
  • Contribute
    • Contribute to the documentation
    • Contribute to the theme
    • Source Code
Docs Tutorials University Contact Us About Us
© 2025 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 01 Apr 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.6
Ask AI