{"id":369166,"date":"2026-09-16T09:14:44","date_gmt":"2026-09-16T09:14:44","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/nahnu-code-api-block\/"},"modified":"2026-09-20T05:10:57","modified_gmt":"2026-09-20T05:10:57","slug":"nahnu-code-block","status":"publish","type":"plugin","link":"https:\/\/sq-xk.wordpress.org\/plugins\/nahnu-code-block\/","author":14745143,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.2","stable_tag":"1.0.2","tested":"7.1.1","requires":"6.3","requires_php":"7.4","requires_plugins":null,"header_name":"Nahnu Code & API Block","header_author":"Ja1me4","header_description":"A standalone block suite for developer documentation: syntax-highlighted code snippets plus API-doc blocks (endpoints, parameters, request\/response examples, status codes, auth, and a live try-it console) \u2014 with light\/dark mode, a collapsible preview, and one-click copy throughout.","assets_banners_color":"19283e","last_updated":"2026-09-20 05:10:57","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/www.wpcodeapiblock.com\/","header_author_uri":"https:\/\/www.nahnuplugins.com\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":86,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"ja1me4","date":"2026-09-16 12:47:08","revision":3698600},"1.0.1":{"tag":"1.0.1","author":"ja1me4","date":"2026-09-18 03:55:01","revision":3701270},"1.0.2":{"tag":"1.0.2","author":"ja1me4","date":"2026-09-20 05:10:57","revision":3703894}},"upgrade_notice":{"1.0.2":"<p>Adds nahnu_code_block_render()\/nahnu_code_block_the() and a [nahnu_code_block] shortcode for rendering blocks outside post content, a Settings \u2192 Nahnu Code Block colors page, per-instance color overrides, a WordPress Shortcode code-block language with a live-preview toggle, and a fix for example shortcodes shown in a code block sometimes being executed by WordPress instead of displayed as inert text. No breaking changes.<\/p>","1.0.1":"<p>Six new blocks (Response Body, Error Codes, Events, API Navigation, Servers, plus a significantly expanded Parameters block), deep-link anchors, and a security fix. No breaking changes.<\/p>","1.0.0":"<p>First public WP.org version.<\/p>"},"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3698225,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3698225,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3698225,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3698225,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":{"nahnu-code-block\/request-response":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/request-response","title":"API Request \/ Response","category":"widgets","icon":"controls-repeat","description":"Tabbed request and response code examples per language, synced across every request\/response block on the page.","keywords":["api","request","response","example","tabs"],"textdomain":"nahnu-code-block","attributes":{"showLineNumbers":{"type":"boolean","default":true},"examples":{"type":"array","default":[{"language":"bash","label":"cURL","requestCode":"curl -X GET https:\/\/api.example.com\/v1\/resource \n  -H \"Authorization: Bearer YOUR_API_KEY\"","responseCode":"{\n  \"id\": \"123\",\n  \"status\": \"ok\"\n}"},{"language":"javascript","label":"JavaScript","requestCode":"const res = await fetch('https:\/\/api.example.com\/v1\/resource', {\n  headers: { Authorization: 'Bearer YOUR_API_KEY' }\n});\nconst data = await res.json();","responseCode":"{\n  \"id\": \"123\",\n  \"status\": \"ok\"\n}"}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/servers":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/servers","title":"API Servers","category":"widgets","icon":"cloud","description":"List an API's base URLs \u2014 production, sandbox, regional endpoints \u2014 each with a label and a copy button. Maps onto OpenAPI's 'servers' array.","keywords":["api","servers","base url","environment","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Base URL"},"servers":{"type":"array","default":[{"url":"https:\/\/api.example.com\/v1","description":"Production"}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/response-body":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/response-body","title":"API Response Body","category":"widgets","icon":"editor-code","description":"Show what an API endpoint actually returns: a 'Returns' description, response headers, and one or more real response bodies grouped by status code, each expandable with its own copy button and an optional 'Show Schema' toggle for the type shape.","keywords":["api","response","body","returns","schema","headers","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Response Body"},"returns":{"type":"string","default":"Returns the resource if the request succeeded."},"showLineNumbers":{"type":"boolean","default":true},"responses":{"type":"array","default":[{"status":"200","contentType":"application\/json","body":"{\n  \"id\": \"123\",\n  \"status\": \"ok\"\n}","schema":[{"name":"id","type":"string","required":true,"description":"Unique identifier."},{"name":"status","type":"string","required":true,"description":"Current status."}],"headers":[]}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/endpoint":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/endpoint","title":"API Endpoint","category":"widgets","icon":"rest-api","description":"Show an API endpoint's HTTP method, path, a short summary, and a longer description \u2014 with an optional deprecation notice and an auth-required indicator.","keywords":["api","endpoint","rest","documentation"],"textdomain":"nahnu-code-block","attributes":{"method":{"type":"string","default":"GET"},"path":{"type":"string","default":"\/v1\/resource"},"summary":{"type":"string","default":""},"description":{"type":"string","default":""},"version":{"type":"string","default":""},"deprecated":{"type":"boolean","default":false},"deprecatedNote":{"type":"string","default":""},"authRequired":{"type":"boolean","default":false},"operationId":{"type":"string","default":""},"relatedOperations":{"type":"array","default":[]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/api-navigation":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/api-navigation","title":"API Navigation","category":"widgets","icon":"menu","description":"Auto-generates a jump-list of every Endpoint block on this page \u2014 no manual list to keep in sync. Scans this page only, not your whole site.","keywords":["api","navigation","endpoints","jump list","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Endpoints on this page"},"showDeprecated":{"type":"boolean","default":true}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/parameters":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/parameters","title":"API Parameters","category":"widgets","icon":"list-view","description":"A parameters table for API documentation: name, type, location, format, default value, example value, allowed values, validation constraints, nullable, read-only\/write-only, required\/optional, deprecated, description, nested object fields, and linkable type references. Can also act as a named, linkable schema definition itself.","keywords":["api","parameters","table","documentation","schema"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Parameters"},"schemaName":{"type":"string","default":""},"parameters":{"type":"array","default":[{"name":"id","type":"string","required":true,"description":"The unique identifier of the resource.","format":"","default":"","example":"","typeRef":"","location":"path","deprecated":false,"enum":"","minimum":"","maximum":"","pattern":"","nullable":false,"readOnly":true,"writeOnly":false,"children":[]},{"name":"address","type":"object","required":false,"description":"The customer's address.","format":"","default":"","example":"","typeRef":"","location":"query","deprecated":false,"enum":"","minimum":"","maximum":"","pattern":"","nullable":false,"readOnly":false,"writeOnly":false,"children":[{"name":"line1","type":"string","required":false,"description":"Address line 1.","format":"","default":"","example":"","typeRef":"","location":"query","deprecated":false,"enum":"","minimum":"","maximum":"","pattern":"","nullable":false,"readOnly":false,"writeOnly":false},{"name":"city","type":"string","required":false,"description":"City.","format":"","default":"","example":"","typeRef":"","location":"query","deprecated":false,"enum":"","minimum":"","maximum":"","pattern":"","nullable":false,"readOnly":false,"writeOnly":false}]}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/try-it":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/try-it","title":"API Try It Console","category":"widgets","icon":"controls-play","description":"A live request console visitors can use to call your API directly from their browser and see the real response.","keywords":["api","try it","console","playground","documentation"],"textdomain":"nahnu-code-block","attributes":{"method":{"type":"string","default":"GET"},"url":{"type":"string","default":"https:\/\/api.example.com\/v1\/resource"},"headers":{"type":"string","default":"Authorization: Bearer YOUR_API_KEY"},"body":{"type":"string","default":""},"warningText":{"type":"string","default":"This sends a real request, from your browser, directly to the URL below. It does not go through this site's server."}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/code-block":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/code-block","title":"Nahnu Code Block","category":"widgets","icon":"editor-code","description":"A professional, syntax-highlighted code snippet block with light\/dark mode, a collapsible preview, a copy button, and a full-code modal.","keywords":["code","snippet","syntax highlighting","prism"],"textdomain":"nahnu-code-block","attributes":{"code":{"type":"string","default":""},"language":{"type":"string","default":"markup"},"title":{"type":"string","default":""},"showLineNumbers":{"type":"boolean","default":true},"collapsedLines":{"type":"number","default":12},"allowThemeToggle":{"type":"boolean","default":true},"viewAllBackgroundColor":{"type":"string","default":""},"viewAllTextColor":{"type":"string","default":""},"livePreview":{"type":"boolean","default":false}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js","editorStyle":"file:.\/editor.css"},"nahnu-code-block\/status-codes":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/status-codes","title":"API Status Codes","category":"widgets","icon":"warning","description":"A table of HTTP status codes your API returns, with meaning, description, and an optional example body.","keywords":["api","status","http","codes","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Response Codes"},"statuses":{"type":"array","default":[{"code":"200","meaning":"OK","description":"The request succeeded.","example":""},{"code":"400","meaning":"Bad Request","description":"The request was malformed.","example":""},{"code":"401","meaning":"Unauthorized","description":"Missing or invalid credentials.","example":""}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/events":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/events","title":"API Events","category":"widgets","icon":"megaphone","description":"List the webhook\/event names a resource can emit (e.g. customer.created), each with a description and an optional example payload.","keywords":["api","events","webhooks","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Events"},"events":{"type":"array","default":[{"name":"customer.created","description":"Occurs whenever a new customer is created.","example":"{\n  \"id\": \"evt_1\",\n  \"type\": \"customer.created\",\n  \"data\": {\n    \"id\": \"cus_1\",\n    \"email\": \"jane@example.com\"\n  }\n}"}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/auth":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/auth","title":"API Authentication","category":"widgets","icon":"lock","description":"Show how to authenticate against an API: bearer token, API key, basic auth, or OAuth 2.0.","keywords":["api","auth","authentication","token","documentation"],"textdomain":"nahnu-code-block","attributes":{"scheme":{"type":"string","default":"bearer"},"headerName":{"type":"string","default":"Authorization"},"placeholder":{"type":"string","default":"YOUR_API_KEY"},"description":{"type":"string","default":"Include this header on every request."}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"},"nahnu-code-block\/error-codes":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"nahnu-code-block\/error-codes","title":"API Error Codes","category":"widgets","icon":"dismiss","description":"Document your API's error types and codes (e.g. invalid_request_error \/ parameter_missing) \u2014 distinct from HTTP status codes, which are transport-level.","keywords":["api","errors","error codes","documentation"],"textdomain":"nahnu-code-block","attributes":{"title":{"type":"string","default":"Errors"},"description":{"type":"string","default":""},"errors":{"type":"array","default":[{"type":"invalid_request_error","code":"parameter_missing","description":"A required parameter was not provided.","example":"{\n  \"error\": {\n    \"type\": \"invalid_request_error\",\n    \"code\": \"parameter_missing\",\n    \"message\": \"Missing required parameter: email.\",\n    \"param\": \"email\"\n  }\n}"}]}},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js"}},"tagged_versions":["1.0.0","1.0.1","1.0.2"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3698225,"resolution":"1","location":"assets","locale":"","width":1600,"height":762},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3698225,"resolution":"2","location":"assets","locale":"","width":1600,"height":762},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3698225,"resolution":"3","location":"assets","locale":"","width":1600,"height":762},"screenshot-4.png":{"filename":"screenshot-4.png","revision":3698225,"resolution":"4","location":"assets","locale":"","width":1600,"height":762}},"screenshots":{"1":"An Endpoint block and a code block together on a documentation page.","2":"The \"View all code\" modal, opened from a collapsed code block.","3":"The Try It Console alongside Authentication, Endpoint, and Parameters blocks.","4":"Editing an Endpoint block's settings in the block editor."}},"plugin_section":[],"plugin_tags":[281022,24363,148076,23853,4609],"plugin_category":[],"plugin_contributors":[267678],"plugin_business_model":[],"class_list":["post-369166","plugin","type-plugin","status-publish","hentry","plugin_tags-api-documentation","plugin_tags-code-block","plugin_tags-gutenberg","plugin_tags-rest-api","plugin_tags-syntax-highlighting","plugin_contributors-ja1me4","plugin_committers-ja1me4"],"banners":{"banner":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/banner-772x250.png?rev=3698225","banner_2x":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/banner-1544x500.png?rev=3698225","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/icon-128x128.png?rev=3698225","icon_2x":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/icon-256x256.png?rev=3698225","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/screenshot-1.png?rev=3698225","caption":"An Endpoint block and a code block together on a documentation page."},{"src":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/screenshot-2.png?rev=3698225","caption":"The \"View all code\" modal, opened from a collapsed code block."},{"src":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/screenshot-3.png?rev=3698225","caption":"The Try It Console alongside Authentication, Endpoint, and Parameters blocks."},{"src":"https:\/\/ps.w.org\/nahnu-code-block\/assets\/screenshot-4.png?rev=3698225","caption":"Editing an Endpoint block's settings in the block editor."}],"raw_content":"<!--section=description-->\n<p>Nahnu Code &amp; 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 \u2014 endpoints, parameter tables, tabbed request\/response examples, status code tables, authentication headers, and a live try-it console.<\/p>\n\n<p><strong>The code block<\/strong><\/p>\n\n<ul>\n<li>Syntax highlighting for 20+ languages, powered by Prism.js and bundled with the plugin (no external CDN requests).<\/li>\n<li>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 <code>&lt;html&gt;<\/code> or <code>&lt;body&gt;<\/code> (filterable).<\/li>\n<li>An optional per-block toggle button so visitors can flip a single code block between light and dark themes manually.<\/li>\n<li>Long snippets collapse to a configurable preview height with a \"View all code\" button that opens the complete snippet in a modal.<\/li>\n<li>One-click Copy button, optional line numbers.<\/li>\n<\/ul>\n\n<p><strong>The API-documentation blocks<\/strong><\/p>\n\n<ul>\n<li><strong>Endpoint<\/strong> \u2014 HTTP method badge, path, a short summary plus an optional longer description, version badge, an optional deprecation notice, an \"Auth Required\" indicator, an \"Operation ID\" for a stable deep-link anchor, a \"See also\" list of related endpoints, and a copy-link icon for deep-linking directly to this endpoint.<\/li>\n<li><strong>Parameters<\/strong> \u2014 a name \/ type \/ location (query, path, header, cookie, body) \/ format \/ default value \/ example value \/ allowed values \/ validation range and pattern \/ nullable \/ read-only or write-only \/ required-optional \/ deprecated \/ description table, with support for nested object parameters (e.g. an <code>address<\/code> parameter with its own <code>line1<\/code>, <code>city<\/code>, etc.), linkable type references (e.g. \"array of <strong>ProgramResponseDto<\/strong>\" linking to another Parameters block set up as that named schema), and a copy-link icon on each row for deep-linking to a specific parameter.<\/li>\n<li><strong>Request \/ Response<\/strong> \u2014 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.<\/li>\n<li><strong>Response Body<\/strong> \u2014 a \"Returns\" description, optional response headers shown as a persistent table, and one or more real response bodies grouped by status code, shown as an expandable accordion with syntax highlighting and its own copy button per response. An optional \"Show Schema\" toggle switches a response between its real example and a lightweight type-shape table. Complements the Status Codes block: Status Codes is the quick-scan summary table, Response Body is the rich single-response view.<\/li>\n<li><strong>Status Codes<\/strong> \u2014 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.<\/li>\n<li><strong>Authentication<\/strong> \u2014 shows the exact header a client needs to send (Bearer token, API key, Basic auth, or OAuth 2.0), with a copy button.<\/li>\n<li><strong>Try It Console<\/strong> \u2014 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.<\/li>\n<li><strong>Error Codes<\/strong> \u2014 document your API's error types and codes (e.g. <code>invalid_request_error<\/code> \/ <code>parameter_missing<\/code>), distinct from HTTP status codes, each with an optional expandable example error body.<\/li>\n<li><strong>Events<\/strong> \u2014 list the webhook\/event names a resource can emit (e.g. <code>customer.created<\/code>), each with a description, an optional expandable example payload, and a copy-link icon.<\/li>\n<li><strong>API Navigation<\/strong> \u2014 auto-generates a jump-list of every Endpoint block on the current page. No manual list to keep in sync as you add or reorder endpoints; scans this page only, never your whole site.<\/li>\n<li><strong>Servers<\/strong> \u2014 list an API's base URLs (production, sandbox, regional) each with a label and a copy button. Maps onto OpenAPI's <code>servers<\/code> array, including server variable templating like <code>{region}<\/code>.<\/li>\n<\/ul>\n\n<p>See every block with a live, interactive demo at <a href=\"https:\/\/www.wpcodeapiblock.com\/all-blocks\/\">wpcodeapiblock.com\/all-blocks<\/a>, or browse the full block-by-block reference at <a href=\"https:\/\/www.wpcodeapiblock.com\/docs\/main\/blocks\/\">wpcodeapiblock.com\/docs\/main\/blocks<\/a>.<\/p>\n\n<p>All blocks share the same visual language and the same light\/dark theming, so a full API reference page looks consistent throughout. Site-wide colors can be set visually under <strong>Settings \u2192 Nahnu Code Block<\/strong> \u2014 no code required \u2014 and any single block can still override just its own colors for one-off branding.<\/p>\n\n<p><strong>Using blocks outside the block editor<\/strong><\/p>\n\n<p>Every block can also be rendered from a <code>[nahnu_code_block block=\"...\"]<\/code> shortcode (for widgets, page builders, or classic-editor content) or directly from PHP via <code>nahnu_code_block_render()<\/code> (for theme templates) \u2014 see <code>INTEGRATION.md<\/code>. Both support the same per-instance color overrides as the settings page.<\/p>\n\n<h4>External services and data<\/h4>\n\n<p>Nahnu Code &amp; 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.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>nahnu-code-block<\/code> folder to <code>\/wp-content\/plugins\/<\/code>, or install the plugin through the <strong>Plugins \u2192 Add New<\/strong> screen in your WordPress admin.<\/li>\n<li>Activate the plugin through the <strong>Plugins<\/strong> screen.<\/li>\n<li>Edit any post or page, add a new block, and search for \"Nahnu\" to see the full set of code and API blocks.<\/li>\n<li>Configure each block from its sidebar settings.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"does%20this%20send%20my%20code%20anywhere%3F\"><h3>Does this send my code anywhere?<\/h3><\/dt>\n<dd><p>No. Everything is rendered on your own server and in the visitor's browser. The plugin makes no external network requests, with the one exception noted above for the Try It Console, which is a request the visitor themselves chooses to send.<\/p><\/dd>\n<dt id=\"will%20this%20conflict%20with%20my%20theme%27s%20or%20another%20plugin%27s%20dark%20mode%20switcher%3F\"><h3>Will this conflict with my theme's or another plugin's dark mode switcher?<\/h3><\/dt>\n<dd><p>It's designed to cooperate rather than compete. By default it follows the visitor's OS-level light\/dark preference. You can also use the <code>nahnu_code_block_dark_mode_selectors<\/code> filter to tell it which CSS selector your existing dark-mode plugin toggles (for example <code>body.dark-mode<\/code>), so the code block switches along with the rest of your site.<\/p><\/dd>\n<dt id=\"can%20i%20integrate%20my%20own%20dark-mode%20toggle%20with%20this%20plugin%3F\"><h3>Can I integrate my own dark-mode toggle with this plugin?<\/h3><\/dt>\n<dd><p>Yes. If your theme or plugin already sets a class or attribute for dark mode (like <code>body.dark-mode<\/code>), add it via the <code>nahnu_code_block_dark_mode_selectors<\/code> PHP filter and it works automatically, with no JavaScript required. If your toggle is JavaScript-driven, call <code>window.NahnuCodeBlock.setTheme('dark' | 'light' | 'auto')<\/code> from your own click handler. Full details, including how to rebrand the actual colors, are in <code>HOOKS.md<\/code> in the plugin folder.<\/p><\/dd>\n<dt id=\"can%20i%20change%20the%20syntax%20highlighting%20or%20table%20colors%3F\"><h3>Can I change the syntax highlighting or table colors?<\/h3><\/dt>\n<dd><p>Yes. All colors are exposed as CSS custom properties scoped to <code>.nahnu-code-block<\/code> (for example <code>--nahnu-code-block-token-string<\/code>), so they can be overridden from your theme's stylesheet without touching plugin files.<\/p><\/dd>\n<dt id=\"is%20the%20try%20it%20console%20safe%20to%20use%3F\"><h3>Is the Try It Console safe to use?<\/h3><\/dt>\n<dd><p>It only ever performs a request from the visitor's own browser to a URL you configure (and the visitor can see and edit before sending). It does not run on, or route through, your WordPress server, so it can't be used to make your server call arbitrary internal or external URLs.<\/p><\/dd>\n<dt id=\"does%20it%20work%20with%20the%20classic%20editor%3F\"><h3>Does it work with the Classic Editor?<\/h3><\/dt>\n<dd><p>No, not by adding a block through the Classic Editor's UI. You can still\nplace any block on a Classic Editor page (or anywhere else outside the\nblock editor) using the <code>[nahnu_code_block block=\"...\"]<\/code> shortcode, or by\ncalling <code>nahnu_code_block_render()<\/code> from a template if you're a\ndeveloper \u2014 see \"Can I render a block from PHP or a theme template?\"\nbelow.<\/p><\/dd>\n<dt id=\"can%20i%20render%20a%20block%20from%20php%20or%20a%20theme%20template%3F\"><h3>Can I render a block from PHP or a theme template?<\/h3><\/dt>\n<dd><p>Yes. Since version 1.0.2, <code>nahnu_code_block_render( 'endpoint', array( 'method' =&gt; 'GET', 'path' =&gt; '\/v1\/users' ) )<\/code>\n(and its echoing counterpart <code>nahnu_code_block_the()<\/code>) renders any of this\nplugin's blocks straight to HTML from a theme template, a widget, or a\npage-builder module \u2014 no post content or block editor required. The same\nthing is available as a <code>[nahnu_code_block block=\"...\"]<\/code> shortcode for\nplaces that only accept shortcodes. Full details, including how to pass\neach block's attributes, are in <code>INTEGRATION.md<\/code>.<\/p><\/dd>\n<dt id=\"can%20i%20customize%20the%20colors%20without%20writing%20code%3F\"><h3>Can I customize the colors without writing code?<\/h3><\/dt>\n<dd><p>Yes. <strong>Settings \u2192 Nahnu Code Block<\/strong> has a color picker for each core\ncolor (accent, text, background, header\/footer background, muted text,\nborder) in both light and dark mode \u2014 every block on your site picks\nthese up automatically, however it was added to the page, including\nblocks placed with the <code>[nahnu_code_block]<\/code> shortcode. A single block or\nshortcode instance can also override just its own colors (e.g. one\npartner-branded endpoint) without changing the site-wide palette \u2014 see\n    HOOKS.md for the shortcode attributes and the equivalent PHP filter.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Added a <strong>WordPress Shortcode<\/strong> language option to the code block, for displaying example <code>[nahnu_code_block ...]<\/code> shortcode syntax (or any other plugin's shortcode syntax) as a properly highlighted, copy-pasteable code sample.<\/li>\n<li>Fixed: an example shortcode shown inside a code block could get picked up and actually executed by WordPress's own <code>do_shortcode()<\/code>, which runs over the entire rendered page after every block (including this one) has already produced its output \u2014 square brackets pass through <code>esc_html()<\/code> untouched, so a literal <code>[nahnu_code_block ...]<\/code> example was never actually inert. The code block's displayed brackets are now encoded as HTML entities at the character level, which a browser still renders as ordinary <code>[<\/code>\/<code>]<\/code> and which the Copy button (reading the browser's own decoded text) still copies as real, directly usable brackets \u2014 but which WordPress's shortcode parser can no longer misread as a real invocation. This fixes example shortcodes silently vanishing (or, worse, swallowing surrounding page content) when shown this way; no double-bracket escaping needed.<\/li>\n<li>Added an optional <strong>\"Show a live rendered preview\"<\/strong> toggle for the WordPress Shortcode language: runs the code sample for real and shows its actual output in a separate, clearly labeled panel below the (still inert) code sample \u2014 useful for demonstrating what a shortcode produces. This runs in isolation on just that one code sample, never on the surrounding page, so it can't affect anything outside its own preview panel.<\/li>\n<li>Added <code>nahnu_code_block_render()<\/code> (and <code>nahnu_code_block_the()<\/code>, its echoing counterpart) so a theme or plugin developer can render any of this plugin's blocks directly from PHP \u2014 in a template file, a widget, or a page-builder module \u2014 without needing the block to live in a post's content or pass through the block editor.<\/li>\n<li>Added a <code>[nahnu_code_block block=\"...\"]<\/code> shortcode wrapping the same rendering path, for widgets, classic-editor content, and page builders that only accept shortcodes.<\/li>\n<li>Fixed: any block whose main attribute is a JSON array or list (Parameters, Response Body, Status Codes, Error Codes, Events, Servers, Request\/Response, Endpoint's related operations) \u2014 as well as the code-block block's <code>code<\/code> attribute \u2014 now reads that value from the shortcode's enclosed content instead of a quoted attribute. A quoted attribute can never safely hold a JSON array (WordPress's own shortcode parser treats any <code>]<\/code> character inside the tag, even deep inside a quoted attribute's value, as the end of that shortcode \u2014 corrupting it the moment the array isn't empty), and can't hold real code containing a quote character either.<\/li>\n<li>Fixed a much bigger issue affecting every <code>[nahnu_code_block]<\/code> attribute on every block, not just the ones above: the shortcode handler was normalizing attributes through <code>shortcode_atts()<\/code> against a list that only ever contained <code>block<\/code> and the seven color-override names, which meant every other attribute a block actually needed \u2014 <code>code<\/code>, <code>method<\/code>, <code>path<\/code>, <code>language<\/code>, all of it \u2014 was being silently discarded before the block ever rendered, on every single shortcode call. On top of that, WordPress always lowercases shortcode attribute names before a callback sees them, which broke every camelCase attribute (<code>operationId<\/code>, <code>authRequired<\/code>, <code>relatedOperations<\/code>, <code>showLineNumbers<\/code>, and others) independently of the first bug. Both are fixed: every attribute now reaches its block correctly, under its real declared name, regardless of the case it was written in.<\/li>\n<li>Added a <strong>Settings \u2192 Nahnu Code Block<\/strong> admin page: a color picker for each core theme color, in both light and dark mode, with no code required. Applies site-wide, to every block however it was placed (block editor, PHP rendering, or the shortcode).<\/li>\n<li>Added per-instance color overrides \u2014 <code>accentColor<\/code>, <code>accentTextColor<\/code>, <code>bgColor<\/code>, <code>chromeBgColor<\/code>, <code>textColor<\/code>, <code>borderColor<\/code>, <code>mutedColor<\/code> shortcode attributes, or a third argument to <code>nahnu_code_block_render()<\/code>\/<code>nahnu_code_block_the()<\/code> \u2014 so a single shortcode or PHP-rendered block can carry its own branding without changing the site-wide palette.<\/li>\n<li>Fixed: a block rendered this new way after <code>wp_head()<\/code> has already printed (the common case for a template file, since it usually runs after <code>get_header()<\/code>) now still gets its stylesheet, instead of silently rendering unstyled.<\/li>\n<li>Documented the new PHP rendering API, shortcode, settings page, and per-instance branding in <code>INTEGRATION.md<\/code> and <code>HOOKS.md<\/code>.<\/li>\n<li>Mobile responsiveness pass across all 12 blocks: the Parameters, Error Codes, Status Codes, Events, and Response Body blocks' tables now scroll horizontally within their own container instead of squeezing columns unreadably or breaking the page's layout on narrow screens. The Try It console's method\/URL row, the Request\/Response language sub-tabs, the Authentication header line, and the Response Body toolbar now wrap onto multiple lines on narrow screens instead of overflowing. The code block's copy\/theme-toggle toolbar and the deep-link anchor icons \u2014 both previously shown only on <code>:hover<\/code> \u2014 are now always visible on touch devices, since touchscreens don't reliably trigger hover states.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Added six new blocks: Response Body (status-code accordion with real response JSON), Error Codes (API-level error taxonomy, distinct from HTTP status codes), Events (webhook\/event names), API Navigation (auto-generated jump-list of Endpoint blocks on the page), and Servers (base URLs, maps onto OpenAPI's <code>servers<\/code> array).<\/li>\n<li>Parameters block: added Format and Default value badges, support for nested object parameters (e.g. an <code>address<\/code> parameter with its own <code>line1<\/code>\/<code>city<\/code> fields), parameter location (<code>query<\/code>\/<code>path<\/code>\/<code>header<\/code>\/<code>cookie<\/code>\/<code>body<\/code>, matching OpenAPI's <code>in<\/code> field), a per-parameter Deprecated flag, and an Allowed-values (<code>enum<\/code>) field.<\/li>\n<li>Added deep-linkable anchors: a copy-link icon on Parameters rows, Endpoint blocks, Error Codes, and Events, each generating a stable, page-unique URL you can share directly to that specific item.<\/li>\n<li>Added <code>nahnu_code_block_build_block_markup()<\/code> \u2014 lets another plugin (e.g. a docs platform importing an OpenAPI spec) generate any of this plugin's blocks programmatically, with correct WordPress block markup and sensible attribute defaults. Documented in the new <code>INTEGRATION.md<\/code>.<\/li>\n<li>Added the <code>nahnu_code_block_pre_attributes<\/code> filter, for third-party plugins that scan the page and inject their own UI into <code>&lt;pre&gt;<\/code> elements (with a real example for WP Super Docs, which was colliding with this plugin's own copy button and language label).<\/li>\n<li>Security: filter-derived theme CSS is now stripped of characters that could break out of the <code>&lt;style&gt;<\/code> element it's printed inside, following a WordPress.org review finding.<\/li>\n<li>Fixed the Copy button not correctly scoping to the clicked item when a block has multiple independent code panels open at once (surfaced by the new Response Body block's accordion).<\/li>\n<li>Fixed two buttons (Auth and Request\/Response) left referencing a CSS class removed during an earlier redesign, which meant they rendered with no styling at all.<\/li>\n<li>Fixed table titles on the Parameters and Status Codes blocks losing their styling after the same redesign.<\/li>\n<li>Corrected the Plugin URI in the plugin header, which pointed at a URL that didn't resolve.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>First public WP.org version.<\/li>\n<\/ul>","raw_excerpt":"A block suite for developer documentation: syntax-highlighted code snippets plus a full set of API-documentation blocks. Website | Documentation | See &hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/369166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=369166"}],"author":[{"embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/ja1me4"}],"wp:attachment":[{"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=369166"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=369166"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=369166"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=369166"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=369166"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sq-xk.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=369166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}