# asciidoctor-code-samples **Repository Path**: mirrors_RestComm/asciidoctor-code-samples ## Basic Information - **Project Name**: asciidoctor-code-samples - **Description**: No description available - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-05-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # asciidoctor-code-samples [Asciidoctor.js](https://asciidoctor.org/docs/asciidoctor.js/) extension that allows to easily add tabbed source code samples in various programming languages for API documentation written in Asciidoctor (this means it also works with [Antora](https://antora.org/)). The extension exposes a new block macro that allows usages like the following: ##### 1. Asciidoctor code for HTTP GET API example: ``` samplecode::sms[httpMethod="GET",urlSuffix="Accounts/#(account_sid)/SMS/Messages.json"] ``` Rendered HTML: ![HTTP GET Example](/doc/images/GET-example.png) ##### 2. Asciidoctor code for HTTP POST API example: ``` samplecode::sms[httpMethod="POST",urlSuffix="Accounts/#(account_sid)/SMS/Messages.json",bodyParameters="From=19876543212&To=13216549878&Body=Test SMS from Restcomm&StatusCallback=http://status.callback.url"] ``` Rendered HTML: ![HTTP POST Example](/doc/images/POST-example.png) ## Quick start TODO: ## Use from Antora TODO: ## How to extend the extension to handle more languages Say for example that you want to support ruby additionally. What you need to do is: * Create `ruby-template.txt` for GET requests and `nodejs-template-post` for POST requests in src/resources/lang-templates/ * Add normalization logic for the new language in `asciidoctor-code-samples.js:generateSample()`, before template is 'compiled' from es6-template-strings * Add interpolation logic for the new language in `asciidoctor-code-samples.js:generateSample()` after template is 'compiled' so that any replacements are made before we have additional interpolation * Add nodejs generated HTML in asciidoctor-code-samples.js:generateSamplesDiv() * Add test cases to check both GET and POST conversion scenarios in `test/test/js`