{"_id":"@asciidoctor-extender/asciidoctor.js-extender","_rev":"2-6b9fd1993cdcc1e774f1f484a7b273be","name":"@asciidoctor-extender/asciidoctor.js-extender","dist-tags":{"latest":"0.1.0-BETA"},"versions":{"0.1.0-BETA":{"name":"@asciidoctor-extender/asciidoctor.js-extender","version":"0.1.0-BETA","description":"An extension registry and handler for asciidoctor.js.","author":{"name":"Richard Rijnberk","email":"r.rijnberk@gmail.com"},"license":"MIT","keywords":["AsciiDoctor","AsciiDoctor.js","Documenting","Extending","Extension","NodeJS","Plugin"],"bin":{"generate-adoc":"lib/cli.ts"},"scripts":{"test":"node lib/cli.ts"},"dependencies":{"asciidoctor.js":"^1.5.6-rc.1","fs-extra":"^5.0.0"},"gitHead":"a9d4a92315b01dc62951ac9547476450aa3110d6","_id":"@asciidoctor-extender/asciidoctor.js-extender@0.1.0-BETA","_npmVersion":"5.6.0","_nodeVersion":"8.0.0","_npmUser":{"name":"rrijnberk","email":"r.rijnberk@gmail.com"},"dist":{"integrity":"sha512-FopC6DLa0JjnQ56Po9LTo7cCv8EcBVPhxcqbtsKnVsQiv9NFoBpuFKLsPPeGirNwXw3URqtml4EdbNvgKKLEJg==","shasum":"3fe3759cfc51de51370a1a923e91f905f13ab9a5","tarball":"https://registry.npmjs.org/@asciidoctor-extender/asciidoctor.js-extender/-/asciidoctor.js-extender-0.1.0-BETA.tgz","fileCount":7,"unpackedSize":8436,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEQNACS1s89JnNm/YN1qPw6dIVXVvVLIHKNgLGOG7R0jAiEAwfe4pfXRmSx5yHKDk+Xl6IomLS1gLOetAJRyiuJE2Ho="}]},"maintainers":[{"name":"rrijnberk","email":"r.rijnberk@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asciidoctor.js-extender_0.1.0-BETA_1523300223728_0.6988772930248672"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-09T18:57:03.672Z","0.1.0-BETA":"2018-04-09T18:57:03.856Z","modified":"2022-04-04T15:43:09.442Z"},"maintainers":[{"name":"rrijnberk","email":"r.rijnberk@gmail.com"}],"description":"An extension registry and handler for asciidoctor.js.","keywords":["AsciiDoctor","AsciiDoctor.js","Documenting","Extending","Extension","NodeJS","Plugin"],"author":{"name":"Richard Rijnberk","email":"r.rijnberk@gmail.com"},"license":"MIT","readme":"# asciidoctor.js-extender\nThe asciidoctor.js extender is a library for extending standard asciidoc with custom\nbuilt plugins. It aims to be a platform which eases extension creation and inclusion\nfor asciidoctor.js. \n\nIf you wish to [submit a bug](#registering-issues), [contribute](#contributing) or \n[request a feature](#requesting-new-features) please follow the guides at the end of this document.\n\n##installation\nTo include the library in your project run the following command:\n```\nnpm install -S @asciidoctor-extender/asciidoctor.js-extender\n```\n\n## Configuring the plugin\n```json\n{\n  \"extensions\": {\n    \"include\": [\n      \"@asciidoctor-extender/adoc-ext-include-markdown\",\n      \"@asciidoctor-extender/adoc-ext-include-scss\"\n    ]\n  },\n  \"source\": \"test/test.adoc\",\n  \"target\": \"target/test\"\n}\n```\n\n**Base attributes**\n\n| Name | Description |\n|:---- |:------------|\n| source | The source file for the documentation |\n| target | The target file name (without extension) to write |\n| extensions | The root for all extensions |\n\n**Extension attributes**\n\n| Name | Description |\n|:---- |:----------- |\n| include | A list of [include](#for-file-inclusion) extensions |\n\n\n## Creating an extension\nFollow these guides for creating extensions. A base requirement for all extensions is that the package name starts with \n**@asciidoctor-extender/** and that the _**main**_ entry point is set. If the _**main**_ entry point is not set the \nlibrary falls back to **./plugin/index.ts**.\n \n\n### For file inclusion\nInclude plugins handle file parsing based on the result of the **handles** callback which gets the **file** target \n(path) as a parameter. The processing of the file content is done by the **process** callback which gets the\n* **document** parameter; which is a reference to the document it's handling,\n* **reader** parameter; which is the document reader\n* **target** parameter; which is a file reference to the targeted file.\n* **attributes** parameter; which is an object containing the attributes as defined by the include declaration.\n\n#### A sample include plugin (for markdown)\n```javascript\nfunction isMarkdownHandler(target) {\n    return target.endsWith('.md');\n}\n\nfunction markdownProcessor(doc, reader, target, attrs) {\n    reader.pushInclude('This is where your markdown should be!', target, target, 1, attrs);\n    return reader;\n}\n\n/**\n * Extension for the handling of markdown files. Converts markdown to AsciiDoc.\n */\nfunction markdownInclusionExtension() {\n    this.handles(isMarkdownHandler);\n    this.process(markdownProcessor);\n}\n\nmodule.exports = markdownInclusionExtension;\n```\n\nThis include extension will replace all include declarations referring to *.md files to the string value \"This is where \nyour markdown should be!\". \n\n# Registering issues\nShould something be awry please feel free to register a bug by creating an issue labeled \"bug\" with a clear description \nof what fails, what is expected and steps to reproduce the error.\n\n\n# Contributing\nTo contribute to this library you can fork the library, implement the feature and create a pull request. Then create an \nissue labeled \"Contribution\" with a clear description of the feature and a reference to the pull request.\n\n# Requesting new features\nIn order to request a new feature please open a new issue labeled \"Feature request\" and a clear description of\nthe functionality that is requested.\n\n","readmeFilename":"README.md"}