BACK TO DIRECTORY

Nahnu Code & API Block

by Jaime Alnassim

0.0
(0 ratings)

Nahnu Code & API Block gives the block editor everything a developer-facing site needs to document code and APIs: a polished syntax-highlighted code block, and a matching family of blocks purpose-built for API reference pages — endpoints, parameter tables, tabbed request/response examples, status code tables, authentication headers, and a live try-it console.

The code block

  • Syntax highlighting for 20+ languages, powered by Prism.js and bundled with the plugin (no external CDN requests).
  • Automatic light/dark mode: follows the visitor’s OS preference, and can also follow a dark-mode class or attribute your theme or another plugin already sets on <html> or <body> (filterable).
  • An optional per-block toggle button so visitors can flip a single code block between light and dark themes manually.
  • Long snippets collapse to a configurable preview height with a “View all code” button that opens the complete snippet in a modal.
  • One-click Copy button, optional line numbers.

The API-documentation blocks

  • Endpoint — HTTP method badge, path, summary, version badge, and an optional deprecation notice.
  • Parameters — a name / type / required-optional / description table.
  • Request / Response — tabbed code examples per language (cURL, JavaScript, Python, PHP, and more), each with Request and Response sub-tabs. Language selection is synced and remembered across every Request/Response block on the same page.
  • Status Codes — a table of the HTTP status codes your API returns, color-coded by class (2xx/3xx/4xx/5xx), with an optional collapsible example response body.
  • Authentication — shows the exact header a client needs to send (Bearer token, API key, Basic auth, or OAuth 2.0), with a copy button.
  • Try It Console — a live request form visitors can edit (URL, headers, body) and send directly from their own browser to see a real response. This performs a genuine client-side request; it never proxies or issues the call from your WordPress server.

All blocks share the same visual language and the same light/dark theming, so a full API reference page looks consistent throughout.

External services and data

Nahnu Code & API Block does not connect to any external service, API, or CDN at runtime, and does not collect, transmit, or store any personal data. The Prism.js syntax-highlighting library is bundled with the plugin files (MIT licensed) rather than loaded from a third-party server. The Try It Console block is the one exception worth being explicit about: when a site visitor clicks “Send request” on that block, their own browser makes a direct HTTP request to whatever URL is shown in that block (which the page author configured, and the visitor can edit). That request comes from the visitor’s browser, not from your WordPress server, and nothing about it is seen by this plugin’s author or by Nahnu.

Screenshots

An Endpoint block and a code block together on a documentation page.

An Endpoint block and a code block together on a documentation page.

The "View all code" modal, opened from a collapsed code block.

The "View all code" modal, opened from a collapsed code block.

The Try It Console alongside Authentication, Endpoint, and Parameters blocks.

The Try It Console alongside Authentication, Endpoint, and Parameters blocks.

Editing an Endpoint block's settings in the block editor.

Editing an Endpoint block's settings in the block editor.

Plugin Details

Active Installs
0
Total Downloads
25
Version
1.0.0
Requires WP
6.3
Requires PHP
7.4
Tested Up To
7.1
Added
2026-09-16
Last Updated
2026-09-16 12:47pm GMT

Ratings

5
0
4
0
3
0
2
0
1
0