@ikerin/build-readme
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -11,3 +11,3 @@ "use strict"; | ||
const escapedSection = section.replace('-', '\\-'); | ||
const result = content.match(new RegExp(`\/\/ << ${escapedSection}\n+(.*)\n+([ ]*)\/\/ ${escapedSection}`, 'msi')); | ||
const result = content.match(new RegExp(`(?:\/\/|#) << ${escapedSection}\n+(.*)\n+([ ]*)(?:\/\/|#) ${escapedSection}`, 'msi')); | ||
if (!result) { | ||
@@ -25,2 +25,3 @@ throw new Error(`Section ${section} does not exist.`); | ||
.map((line) => line.substr(indent.length)) | ||
.filter((row) => !row.match(/\/\/ (<< )?[0-9a-zA-Z\-]+/)) | ||
.join('\n') | ||
@@ -27,0 +28,0 @@ .trim(), |
{ | ||
"name": "@ikerin/build-readme", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -35,2 +35,18 @@ # Build Readme | ||
There is also support for `#` style comments | ||
> [examples/oapi.yaml:(test-section)](examples/oapi.yaml) | ||
```yaml | ||
--- | ||
openapi: 3.0.0 | ||
info: | ||
# << test-section | ||
title: Simple API | ||
version: 1.0.0 | ||
# test-section | ||
servers: | ||
- url: 'http: //localhost:3333' | ||
``` | ||
## Running the tests | ||
@@ -37,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
176385
97
86