{"_id":"@alotool/shortcode","_rev":"4-f239918588938560c795d3bf04a793ae","time":{"1.1.0":"2020-12-11T08:00:47.391Z","created":"2020-12-11T08:03:33.684Z","1.1.0-beta.1":"2020-12-11T08:03:33.850Z","modified":"2022-04-04T13:37:34.134Z"},"name":"@alotool/shortcode","dist-tags":{"latest":"1.1.0-beta.1"},"versions":{"1.1.0-beta.1":{"name":"@alotool/shortcode","version":"1.1.0-beta.1","version_current":"1.1.0-beta.1","description":"Replace wordpress-style shortcode strings with anything","keywords":["alotool","shortcode","blogger","blogspot","theme","template","google"],"author":{"name":"alotool"},"license":"MIT","homepage":"https://github.com/alotool/lib","repository":{"type":"git","url":"git+https://github.com/alotool/lib.git"},"bugs":{"url":"https://github.com/alotool/lib/issues"},"main":"dist/shortcode.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"devDependencies":{"jquery":"^2.1.1","del":"^6.0.0","gulp":"^4.0.2","gulp-concat":"^2.6.1","gulp-notify":"^3.2.0","gulp-size":"^3.0.0","gulp-uglify":"^3.0.2"},"_id":"@alotool/shortcode@1.1.0-beta.1","_nodeVersion":"12.18.1","_npmVersion":"6.14.9","dist":{"integrity":"sha512-JHuCEhHhHekrJawH19Iq6bxhOA8+p1gVdRhAyfoKQlJi7TtxzNHfUapozHW2hCkJH1gLKl7XgKD2cGmriSq1zQ==","shasum":"f3d1649d9fc415355999377879e275c9323c075b","tarball":"https://registry.npmjs.org/@alotool/shortcode/-/shortcode-1.1.0-beta.1.tgz","fileCount":5,"unpackedSize":12322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0yfWCRA9TVsSAnZWagAAk74QAIL0yg10D2j0j0YxGRdd\n7iynVMG7FASaMk1olR/vOymSOYGdpYfjx4/VzAute1vklOeglRqb+cFe6bkM\nqJj9xu++hzs4TrYo8JIZq2wH+ZTxtp3gL4/o5YAC5FKKpMx+OfGIf3yrjbJ7\nIY3NjYVAeiHeND/KHEtUsM3X2DRUH+WR8mM+RKXtyZrh9turZCpwjzacFDWt\nZkJVXvr3qnSTKy5a8yaL/CEixVQzWYPIRhLik+kmghEN550HsdNuIrhVN8hk\n31MRHCoerzM0MrJyQqgvOh1kVrRg1+zqwBY188bZYsu4PUUre6MOp2D0WsLS\ncSLr3OVC2q33mG+fcJEhqQkjXUxtI9MRFT9OIKp7xty7GMISrKYdjvTaoB3e\n3py9Gcs0uy1z/BHdGn7G6OvV2KXgqDkGFJJJiG6Bnfdq2+pn8HLPsmYUg01G\ns+LaWXjXaHKFAC7HFPPTR1NsnyAkXlsJfaPwHQ//bUGVpyCIX/hztNyoVWt9\nTIxOpk4s7xiub/OLdv6z2/2yroVPKWwOcS9iyucCXZthQqk7FJXRALLJpeFm\ndh+Apeu2+GeCkv2I3X9GUzwKFz/4DeDXiiSan6P7kcdZiFGCa9aXPbCBYlUj\niCcp/6Nth7CnSGjxhCbmoJ/rZ+SQhtxIv9lSejt9fA6cITt7rn2bmTJXx69S\n3X73\r\n=yasA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBLzD3p7WebbMaXhcsKWGw+JsItA0DpyW5EVCqCns8qdAiEA+kAJGFbiW6zmGsyU/GAIScUZava67Q0xnLkVIcOfNOw="}]},"_npmUser":{"name":"alotool","email":"alotool360@gmail.com"},"directories":{},"maintainers":[{"name":"alotool","email":"alotool360@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/shortcode_1.1.0-beta.1_1607673813720_0.4747735724204021"},"_hasShrinkwrap":false}},"maintainers":[{"name":"alotool","email":"alotool360@gmail.com"}],"description":"Replace wordpress-style shortcode strings with anything","homepage":"https://github.com/alotool/lib","keywords":["alotool","shortcode","blogger","blogspot","theme","template","google"],"repository":{"type":"git","url":"git+https://github.com/alotool/lib.git"},"author":{"name":"alotool"},"bugs":{"url":"https://github.com/alotool/lib/issues"},"license":"MIT","readme":"# [SHORTCODE](https://github.com/alotool/lib)\n\n\n## Usage\n\n`shortcode` accepts 2 arguments: an element, and an object of tags to match.\n\nEach tag method returns a string to replace the original tag (in the DOM) and accepts an (optional) asynchronous callback. `this` is bound to the match object.\n\n```javascript\n/* Replaces [hello text=\"Hello world\"] in `body` with \"Hello world\" */\nnew Shortcode(document.querySelector('body'), {\n  hello: function() {\n    return this.options.text;\n  }\n});\n```\nTip: Because shortcode replaces an element's html, you will lose existing event bindings inside that element. Use delegated bindings where possible and call shortcode at the start of your code.\n\n\n## Features\n\n* Supports multiple tag instances\n* Supports single and start-end tags\n* Supports multi-line tags\n* Supports asynchronous callbacks\n* Supports DOM or jQuery selectors\n* Includes jQuery plugin definition\n* Ignores tags inside `pre` and `code`\n* Tested with Jasmine\n\n\n## Supported browsers\n\nShortcode.js should work in any browser that supports `Function.prototype.bind` (Sorry IE7 & 8). If you need to support <IE9, try the [polyfill published in MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility).\n\n\n## Using async\n\nSometimes you need to do asynchronous work. Don't return anything from the shortcode method. Instead, call `done` with your return value to update the DOM.\n\n```javascript\nnew Shortcode(document.querySelector('body'), {\n  hello: function(done) {\n    var self = this;\n\n    /* setTimeout is used here to simulate an async event */\n    setTimeout(function() {\n      done(self.options.text);\n    }, 1000);\n  }\n});\n```\n\n\n## Start and end tags\n\nShortcode.js supports tags like `[note]This is a note[/note]`. The content between tags will be availble in your callback under `this.contents`.\n\n```javascript\nnew Shortcode(document.querySelector('body'), {\n  note: function(done) {\n    return this.contents;\n  }\n});\n```\n\n\n## jQuery\n\nWhile shortcode.js doesn't rely on jQuery, you may find it convenient to use. Shortcode can accept a jQuery object or a DOM object as the first argument.\n\nAlternatively, a jQuery plugin wrapper is supplied.\n\n```javascript\n$('body').shortcode({\n  hello: function() {\n    return this.options.text;\n  }\n});\n```\n\n### Publish package to NPM package registry\n```shell script\nnpm login\nnpm publish --access public\n```\n\n### Unpublishing a single version of a package\n```shell script\nnpm unpublish <package-name>@<version>\n```\n\n### Unpublishing an entire package\n```shell script\nnpm unpublish <package-name> -f\n```","readmeFilename":"README.md"}