{"_id":"@austinjherman/ah-shortcodes","_rev":"2-6df890bbbe89ee03bfe2d3b332a8c001","name":"@austinjherman/ah-shortcodes","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@austinjherman/ah-shortcodes","version":"1.0.0","description":"An unopinionated and extensible shortcode parser that can process shortcodes anywhere in your content, from any CMS.","main":"index.js","keywords":["shortcodes"],"scripts":{"test":"node ./test/shortcodeParser.test.js"},"repository":{"type":"git","url":"git+https://github.com/austinjherman/ah-shortcodes.git"},"author":{"name":"Austin Herman"},"license":"MIT","bugs":{"url":"https://github.com/austinjherman/ah-shortcodes/issues"},"homepage":"https://github.com/austinjherman/ah-shortcodes#readme","dependencies":{"json5":"^2.1.3"},"directories":{"test":"test"},"devDependencies":{},"gitHead":"3ecd1cf2d22f989ba3ef1c039c79e81b654bc0e5","_id":"@austinjherman/ah-shortcodes@1.0.0","_nodeVersion":"12.14.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-RUiAJ8XmPd2V9/MHbjxqjQdfs1GP+PLNetbk8SRjbjTwrBuoCianZtGX4FsuwgldgvnjmrtSDzQ1AjlKOP7kzQ==","shasum":"5ccd65e195a7641db070d805d504fb03cac66f3c","tarball":"https://registry.npmjs.org/@austinjherman/ah-shortcodes/-/ah-shortcodes-1.0.0.tgz","fileCount":6,"unpackedSize":11862,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgf0PyCRA9TVsSAnZWagAAP8MP/iUCDAYrUAsGy/QdtW+a\nz2gTGhBs/HsoxNesv75I6kBl9L4A2gcIwil/hhUcIP7o4aXRJ/cruRgJ3k6o\nTh+GRADRWR2cUq7wcWdhwz2lOJ9CIokZjaks5tXVpwKDZfxkRRnNvzttNGiE\n2wezrtiS3E/5OOc0X5+D5pRUV4JBPXQSLGFIbPQ8zUJ7Nc8/gHteN9qGcnrV\nsllfUNdzvCaN7EOzgG3dX0vp+c7VPaR93S9xwL5ijzEf+XcRpdTLRudklVUR\nef+xb7Td8sBU0rH5xt4dNGFU5/yqZC7iQwDE78qG1uqbbzXaTqNo4ZhGLqBc\nPC9QYbCjN3gYelks0EQDK03wuxJcz+fyQUCeWaTuInilu1J7kabJDL5HX8wY\nOyaQ9bYbQcz2QdfAc2q0TreJZGaAJM+8HgsBMFR2PgK5CyNlb4kP/q7YbSjv\nFnnl4IJJ3rp+ULgm8VCSNLVc1cLcwXsUlkjpfgdorqxEUlFFAxQWu4o+fdAA\nACl5sYptILld7/GYkyhwLrK1eJQTojSiIcl2atlIa1BbtPIj+tRjZAA9ZrdX\nlCwMmEXAaHw/OrKhL6LtjazdNz9suINz4HL+eq52OIpOqnjjhZRW55Ujv/Bz\nOT+ErKDvdPOYkAQs6sGLXALnM9K3VQM9ngVDBq9U7ICikghSkAsCbH67dppN\nUUrN\r\n=kKeV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFBYJQztS1V3DWS0uTH1gezSDOLQBMRF4kJ/MwsAiwZmAiBxqLwxfn8YeZqGBY7INTbuQ7l5SWZmzzMBsmDE2BlL7A=="}]},"_npmUser":{"name":"austinjherman","email":"austin.j.herman@gmail.com"},"maintainers":[{"name":"austinjherman","email":"austin.j.herman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ah-shortcodes_1.0.0_1618953201588_0.8108708727473801"},"_hasShrinkwrap":false},"1.0.1":{"name":"@austinjherman/ah-shortcodes","version":"1.0.1","description":"An unopinionated and extensible shortcode parser that can process shortcodes anywhere in your content, from any CMS.","main":"index.js","keywords":["shortcodes"],"scripts":{"test":"node ./test/shortcodeParser.test.js"},"repository":{"type":"git","url":"git+https://github.com/austinjherman/ah-shortcodes.git"},"author":{"name":"Austin Herman"},"license":"MIT","bugs":{"url":"https://github.com/austinjherman/ah-shortcodes/issues"},"homepage":"https://github.com/austinjherman/ah-shortcodes#readme","dependencies":{"json5":"^2.1.3"},"directories":{"test":"test"},"devDependencies":{},"gitHead":"37c1208ad7fe1fc03bc7e778473306cf31e534cf","_id":"@austinjherman/ah-shortcodes@1.0.1","_nodeVersion":"12.14.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-SP6SxP4V1QCYXHPyjzHuNRAcHBTmPPD3hoCV+vzGN6xdNYfQiRziMT9P+lz2hetik21e1ap4y5Yo9XxVHMIBwA==","shasum":"b440f52c93ec12d62a9cd0b9d13fdcc623644f9b","tarball":"https://registry.npmjs.org/@austinjherman/ah-shortcodes/-/ah-shortcodes-1.0.1.tgz","fileCount":7,"unpackedSize":11978,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgi2F9CRA9TVsSAnZWagAA2lsP/1FlzPrvXU7x2yBjVE5i\nrOs6GLMbuZCP7PMh4g32paUJ8QSiZBd1Ndlb54DQgxwGbK8CVw7JTyuTaXdk\nyrgV5bh/as2zSsw9jh1F7xdtKaMwoNHkwHmO8liJsAybJqmfxAqqW+UyMAaN\nO1NyNf40x8e3VE5m3KguJ7LB3VyLoEOFpKC2v9D6TCp1jvHHHper/yZlFvRx\npT59TIrXPybtqXcmDJnsYgt2tIp4cHSf6b374ED623YnkAo0IMe6+hVVrWWf\nxrbBC31qdwsMaV+c4K3+z7YQernjNM+IEFt7uZvm+Js5byZOfHpbEVuNHzYQ\nOHE/dg7Wr6e1wG02iRo8bI/H8PdlJEXrNeorlGeFFSwzgE3eqi71flOxfN/H\nNzzRftuWcmRNcSpe9GnhiQ34FTxPC9IYTr1mS8NfIDqfPgKmIC0CzKhoSUKr\nvYD32euBT5afVQ0nr4YUxyUvseS/HOwwa4khARFewugy58g09AstZhlZqGdp\nUX9+PZRCIbmbDagMZBYIRe3d1jtUAaRkJ/OhsnnSeVGzQn3eaF/Fp6DrgL+8\nwkKecKo15gWRJ0RxH03038Gs9JJ3nLif7MDsts5IegQGOcHoWaHhWajJBav6\nr5lmBZJWPY2tc05yOqOrwVC+TLeJ495n8PgMr20XDk3xsenl3K9skD6JVikz\n18TO\r\n=/CtJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGwUbpILbNAD69vHMXe/w9BF2f3WgJ/pyhu8nM8lLWjCAiEA7Z3pRlUcyO9lWuEep25EsKeUApgx6dBnNTKmIe/WW5g="}]},"_npmUser":{"name":"austinjherman","email":"austin.j.herman@gmail.com"},"maintainers":[{"name":"austinjherman","email":"austin.j.herman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ah-shortcodes_1.0.1_1619747196930_0.16392036281956246"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-20T21:13:21.539Z","1.0.0":"2021-04-20T21:13:21.730Z","modified":"2022-04-04T16:30:19.270Z","1.0.1":"2021-04-30T01:46:37.051Z"},"maintainers":[{"name":"austinjherman","email":"austin.j.herman@gmail.com"}],"description":"An unopinionated and extensible shortcode parser that can process shortcodes anywhere in your content, from any CMS.","homepage":"https://github.com/austinjherman/ah-shortcodes#readme","keywords":["shortcodes"],"repository":{"type":"git","url":"git+https://github.com/austinjherman/ah-shortcodes.git"},"author":{"name":"Austin Herman"},"bugs":{"url":"https://github.com/austinjherman/ah-shortcodes/issues"},"license":"MIT","readme":"# Shortcode Parser\nNeed shortcodes? This unopinionated and extensible shortcode parser can process shortcodes anywhere in your content, from any CMS. \n\n## Usage\n\n### In Your Content\n\nThis is an example of using the shortcode parser in content. {{ type: \"replace\", content: \"Hello, world!\" }}<br/>\n  \n-> This is an example of using the shortcode parser in content. Hello, world!\n\nThis is another example using variables. {{ type: \"replace\", content: \"Hello, \\\\${b.nested.value}!\" }}<br/>\n\n-> This is another example uusing variables. Hello, variables!\n\n\n### In Code\n```javascript\n\nimport ShortcodeParser from '@austinjherman/ah-shortcodes';\n\n// We can feed the parser an object of variables to \n// use in our shortcodes.\nconst variables = {\n  a: \"ice cream\",\n  b: {\n    nested: {\n      value: \"variables\"\n    }\n  },\n  c: \"wine\"\n};\n\n// We can write a simple function to run over our content.\n// This function will simply replace the shortcode with the \n// content inside of it.\nconst replaceParser = (content, obj, originalMatch) => {\n  const objType = obj.type;\n  if(objType === 'replace') {\n    const updatedContent = obj.content;\n    content = content.replace(originalMatch, updatedContent);\n  }\n  return content;\n};\n      \n// Write as many filter functions as you want.\nconst filterFunctions = [replaceParser];\n\n// Instantiate the parser.\nsp = new ShortcodeParser(variables, filterFunctions);\n\n// Resolve your shortcodes.\nsp.parse(\"Your content here!! {{ type: 'replace', content: 'example' }}\");\n```\n\n## Development\n\n### Installation\n- clone this repo\n- `npm i`\n\n### Run Tests\n- `node ./test/shortcodeParser.test.js`","readmeFilename":"README.md"}