{"_id":"@ayushn21/actiontext-syntax-highlighter","_rev":"4-40839303f9edc37102a3062e2e764557","name":"@ayushn21/actiontext-syntax-highlighter","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@ayushn21/actiontext-syntax-highlighter","version":"0.1.0","description":"Extends ActionText to support highlighed code blocks","main":"dist/modules/javascript/actiontext_syntax_highlighter.js","homepage":"https://github.com/ayushn21/actiontext-syntax-highlighter","repository":{"type":"git","url":"git+https://github.com/ayushn21/actiontext-syntax-highlighter"},"bugs":{"url":"https://github.com/ayushn21/actiontext-syntax-highlighter/issues"},"author":{"name":"Ayush Newatia","email":"ayush@hey.com","url":"https://github.com/ayushn21"},"license":"MIT","peerDependencies":{"trix":"^1.3.0"},"devDependencies":{"css-loader":"^4.3.0","esbuild":"^0.12.5","esbuild-loader":"^2.10.0","style-loader":"^2.0.0","webpack":"^5.6.0","webpack-cli":"^4.2.0"},"licenseText":"Copyright 2021 Ayush Newatia\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@ayushn21/actiontext-syntax-highlighter@0.1.0","dist":{"shasum":"7361a1f9880d30e6980b5937018589b925665eb5","integrity":"sha512-1XzOAJK2HxPBv2KCH+zbEQYV8KZTy1n8v6TJLWHmqpXnJIFDj6OqieRsRv+VogWCYdqxK5yH1/XP0MKh9nCCdQ==","tarball":"https://registry.npmjs.org/@ayushn21/actiontext-syntax-highlighter/-/actiontext-syntax-highlighter-0.1.0.tgz","fileCount":41,"unpackedSize":176576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtiJgCRA9TVsSAnZWagAAnwsP/iAyksAZqwLOmUXBSB/p\nTEA7kDpMIw//kPLBlTYSlRBeB3TF3jfx0aczxBp1Meww9FtizRb6nyA/U8fV\nCKzzwpX28pqXUkJuDJwpLC4I1ZcSb2JaGVzJ+00QMzJTAJyxo/brHvp7a6gN\nOFnqf6m92r3XkvsFrs69dWBMPQ+Ym924tPgRXJ7DL3c3gK/T75ircxcYTMZr\nhDJTd1vlAODBFSsBttsH6yiKrOxys/EOtG03m0iaE28pUFiJifBz6BLSOtfg\nO1jBgzO/2szk/vkPmFHbWHKHwGBSaSygK4s14edcC0vse1m4qyvPU+W/VrMQ\nX1fxGiKisur1A5wN31vPOsPFAIug/jFX8v7UqKxZPgnPxqVUKewt09vR8eEd\nH2r5YIcNbLIICM1EWIAnO0c2wuH+ZqOI9NQqIFQtgshp93aM77nM166h22WZ\ns5SjbHS/bPFKD2DQhtZq6Tlor192okR0LQT6c30jesgpCw2HavIglhRBTOyq\nCPiXl2d46QBBr+KAV4pmoiZ3a0u7l9ozM1MYFv3y6TqPQDACyuO2ZO/kTfuY\nwJ4m4VLSp8PpyFBdEjBj3xSq7Ktj3H+CZc2LX0EjvKOIARcO2o2vjdapMUDY\nPvnIAzUEnubpzDkSJbILnrTXd5xhIpYvjvjn6TjCSkKROAnPthp8XjlK1m1n\nD0mD\r\n=cAuy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDl0S/SE32MQp5mGu8XXYdMwVnAl9tt/Qnz+PF1M4EGpgIhANxM/iuGCD8eeNKfCKJhKkchYLGnZzuEXN2CQR333Oix"}]},"_npmUser":{"name":"ayushn21","email":"ayush@hey.com"},"directories":{},"maintainers":[{"name":"ayushn21","email":"ayush@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/actiontext-syntax-highlighter_0.1.0_1622549087880_0.1895999593348714"},"_hasShrinkwrap":false},"0.1.1":{"name":"@ayushn21/actiontext-syntax-highlighter","version":"0.1.1","description":"Extends ActionText to support highlighed code blocks","main":"dist/modules/javascript/actiontext_syntax_highlighter.js","homepage":"https://github.com/ayushn21/actiontext-syntax-highlighter","repository":{"type":"git","url":"git+https://github.com/ayushn21/actiontext-syntax-highlighter"},"bugs":{"url":"https://github.com/ayushn21/actiontext-syntax-highlighter/issues"},"author":{"name":"Ayush Newatia","email":"ayush@hey.com","url":"https://github.com/ayushn21"},"license":"MIT","peerDependencies":{"trix":"^1.3.0"},"devDependencies":{"css-loader":"^4.3.0","esbuild":"^0.12.5","esbuild-loader":"^2.10.0","style-loader":"^2.0.0","webpack":"^5.6.0","webpack-cli":"^4.2.0"},"licenseText":"Copyright 2021 Ayush Newatia\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@ayushn21/actiontext-syntax-highlighter@0.1.1","dist":{"shasum":"090c2cd80686ffb699ca72e8e38bde47558a8f5f","integrity":"sha512-5ABfej2Zb24rcQ/9vYRQzO4t9Qv0zn1zT4yOdlStx554htwMzZzCCzpPXOGV0a7Ns1jstoF1UwaQNLFgAFpCeA==","tarball":"https://registry.npmjs.org/@ayushn21/actiontext-syntax-highlighter/-/actiontext-syntax-highlighter-0.1.1.tgz","fileCount":41,"unpackedSize":177497,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtjY9CRA9TVsSAnZWagAAeOsP/2gLjyeTzMOSysefFqbc\n5CDMPJA17yYjbjYfTUpC7R45govDRdmlVMBjsDP4VGkaktNKC7DNhQQK4wj1\nH57se53CGgApJkR40Lp0zn4CaU5Y7kgCCIDn1yi/gCqZVqZ4+Ekf751aLFFK\nd0vYfHTEg2WyQ1lidkfEFjoUiMKjWBi0QjpNBcrewXACAMmeLJE+OjeLWwFq\nW7efUCiOE7Zb3wdBNYZbO6MuzRiXLQ90Xkaj7iPezeSnfkbwqD4asN0by7fh\n7V2nn1Ja7gxNQKSYN1rkUhJ67rgo9MFlbhbxScxpWv7VGGb46osIVAIomhDY\nWGBNmDIanf/IdIcmTlo1BhSUXE7YLVP5Ezy4QgAmm07f81SEuqPBiR03u2xk\nsScLKMKpQE828OwZgk3xu6IPrgJP8APN9fNLWQ0lW1sWMIn63qBAWmS+DHyu\nDg7BnRCjrW354NZAnHdjUNNzRF7S3Cy2jb0BFJIQ0neMvRl5WET9sr12l2d0\nyXQ2UefSlAz161lPUBugWZ2WZhrWP5Qzj7DE57vw9Wvg2WUNAbF01a/S9gxz\nZ/sGJh4l4HPuxiwXLHak6DtzEOk/k79PaGsqkUV7xhvNVyzBcUOh61dm4g/1\nNFLRm62FM5f5Ue+M9yylhe1Y4KpqC6XjSPibfiXAj5IhomVG7vuOJQXt9bES\nnl2c\r\n=82yK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGkMf17Q1Roc2c+9nLty9AEgy1sLzW8S4Ukq7QWNaQihAiEAgVp9YrqM9rRWSC9l9xWIonHnTxdYzASsyskCCfyijJs="}]},"_npmUser":{"name":"ayushn21","email":"ayush@hey.com"},"directories":{},"maintainers":[{"name":"ayushn21","email":"ayush@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/actiontext-syntax-highlighter_0.1.1_1622554173497_0.7765997902041961"},"_hasShrinkwrap":false},"0.1.2":{"name":"@ayushn21/actiontext-syntax-highlighter","version":"0.1.2","description":"Extends ActionText to support highlighed code blocks","main":"dist/modules/javascript/actiontext_syntax_highlighter.js","homepage":"https://github.com/ayushn21/actiontext-syntax-highlighter","repository":{"type":"git","url":"git+https://github.com/ayushn21/actiontext-syntax-highlighter"},"bugs":{"url":"https://github.com/ayushn21/actiontext-syntax-highlighter/issues"},"author":{"name":"Ayush Newatia","email":"ayush@hey.com","url":"https://github.com/ayushn21"},"license":"MIT","peerDependencies":{"trix":"^1.3.0"},"devDependencies":{"css-loader":"^4.3.0","esbuild":"^0.12.5","esbuild-loader":"^2.10.0","style-loader":"^2.0.0","webpack":"^5.6.0","webpack-cli":"^4.2.0"},"licenseText":"Copyright 2021 Ayush Newatia\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@ayushn21/actiontext-syntax-highlighter@0.1.2","dist":{"shasum":"9e20cb1ad07ec851e6804068122fa90bcd53d3d9","integrity":"sha512-MDX2lBOzt3fYMhOl9LmFgdGIWk8vuiqKs7i94RXYRScfkibL4yfqh33brbO8kUq5sygYmwPvFeSqEAACfncmcQ==","tarball":"https://registry.npmjs.org/@ayushn21/actiontext-syntax-highlighter/-/actiontext-syntax-highlighter-0.1.2.tgz","fileCount":41,"unpackedSize":177526,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtkAACRA9TVsSAnZWagAAFegQAIX+lAEQE8U7BvrPXN+Y\nXkB/DHQNOpjSmkPyeQaN7LF6simDammEQa1SgSlNayt4eU4fdE70HOjhmnp9\nNR9MqBHHqxCaUaqqP6Suxl6ZuBrfSNgP/BR7tOENc/97KhehRUsWQPBx4mhw\niPRKW/IzEHpRGhb/ROloTYuVuhObqLFn2osKWKAHeqs0FpksXzDMcH+rilWb\nQmlbexct/0/PLMCxK2tctgvsHuyy+VBB9JSvBTbSPYEZ7gf2ysU61jXDU4Je\nDhVeUdbcp4dxBgZ/tqCR1cBgJqoUckZ8FcV17k0goAlCS8+/ZTVEp3GAdFXC\nySER1rysQc6L/HV6fca3Sg6KNUn12NKO6kxVJyhedC1JPAb5YA54d/k9RVI+\nW+uI8IatdiYGKieRJMYP5OyvuNzGnZ/FZn+B0crpRm4MsZ86b8yKUlfuINAQ\nuocqSBY+cuqGSm+jdMdfSJ6pkSYhKWJ9mIE0TmTBCliQfKVEYy7eC3HsFNkm\n0b9SkRo7l93xYoEA3w4TtXIsDw8PM5rMoIXpi1lLbEgvvIaQTMpOE6lao7bl\nSsx8wONRM/qC3vm7pP1aAjTREWNvNJ5drWwECIedrOjNs3Rf2XUukxa1zE9V\nCT2I3/p03p5KV9nTHtzvdbrIXzcIZ4xQuhPFPS9oXCpTZ0v9bC0J8GpP3uJQ\njGbz\r\n=Wp0v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHu2O56ceiuFPOUQ0T1tS5/hL/eD5oaoixlqBgzkOLrxAiEAzaMPZWTNkki8nwxDfU8ezhPAr0Q/Ds/PY/upqHcpN6w="}]},"_npmUser":{"name":"ayushn21","email":"ayush@hey.com"},"directories":{},"maintainers":[{"name":"ayushn21","email":"ayush@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/actiontext-syntax-highlighter_0.1.2_1622556672412_0.38015831717268544"},"_hasShrinkwrap":false},"0.1.3":{"name":"@ayushn21/actiontext-syntax-highlighter","version":"0.1.3","description":"Extends ActionText to support highlighed code blocks","main":"dist/modules/javascript/actiontext_syntax_highlighter.js","homepage":"https://github.com/ayushn21/actiontext-syntax-highlighter","repository":{"type":"git","url":"git+https://github.com/ayushn21/actiontext-syntax-highlighter"},"bugs":{"url":"https://github.com/ayushn21/actiontext-syntax-highlighter/issues"},"author":{"name":"Ayush Newatia","email":"ayush@hey.com","url":"https://github.com/ayushn21"},"license":"MIT","peerDependencies":{"trix":"^1.3.0"},"devDependencies":{"css-loader":"^4.3.0","esbuild":"^0.12.5","esbuild-loader":"^2.10.0","style-loader":"^2.0.0","webpack":"^5.6.0","webpack-cli":"^4.2.0"},"licenseText":"Copyright 2021 Ayush Newatia\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@ayushn21/actiontext-syntax-highlighter@0.1.3","dist":{"shasum":"384c061f0040133932d7a4cfda500b8303361487","integrity":"sha512-12Mk3Pw1z6itqVHMOfuHX7uNN8g/U+Wucx0gQUQUamInAfHsQ6gUVnv/iRzIpLu5Itbo/x2Izy44nhOjZcAUag==","tarball":"https://registry.npmjs.org/@ayushn21/actiontext-syntax-highlighter/-/actiontext-syntax-highlighter-0.1.3.tgz","fileCount":41,"unpackedSize":177744,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgve+OCRA9TVsSAnZWagAAu7gQAIWQRZCpKDxfnZ8nwzdO\nt59CyjAPiw82UtWFCzVq2CWLap6C2cqAI/lt5ePqqiXTpluxrGJ7tW1Uh+CB\nR0KDpUjRUSlJ/5AY6d87xHgfQ1FJ5G8LdSWWEo78nXMwsIh3Om0j3NcAZSe3\nOubWgTsyLakKqCTyK3Hfuli0huv0MWo3EiYkYG6naAENr71awKuXRwrAEUvR\np1iu/SwXpkdsNq8wYgoNzoW4NCd43IQ6FzcEcQS2ZuUvYh6yimyVugnTEwg7\n5nItLegpRKEuIV9+CQ9vySctxEIhCBM/uVz4rLr6iujSwQoFVHc6f1fI1B+s\nG6LbgqSU43s45roBDdrpZCtvBDCaE6vSCW1+mJ5miRJSPowk/5fYy+cOowGN\ndYy/aknjhmEDNQ8rPett6hj0V5/VulOklrZXVGTLtTDY7zT19qeFSc11fpyz\nOuqj9C5qW3/XAr6wFZg0UaX2Tfd837lXLRGPtB/Z9PiiAlQsIbJYMq3QfoAq\n3Kq0Lt3igdOERGlCmUsvhFWKMCppn8Xwgsv8iWqAPphcn7ehtECQwFoMv2w9\nrgG6pcSHfucYBf7bAHamh54/ILLzrHHGrKpmwkWHZhf/bfsW5O3i7s0BSQ+3\nUxjeOs776xB1qDgsmTeG94Chl/WW9+EAH+nBm10cCzOVEr0VC29O3KopppML\nvXYk\r\n=G4U0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzImiD7Cr9hfzykpK6BadS4MOQ3jinrwrz7gOOJVMEFAIhAOLP2oT+KJ+z5OQth8/A5NfiKYvAJlcAz28+R11QgvMy"}]},"_npmUser":{"name":"ayushn21","email":"ayush@hey.com"},"directories":{},"maintainers":[{"name":"ayushn21","email":"ayush@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/actiontext-syntax-highlighter_0.1.3_1623060366544_0.9210572660376415"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-01T12:04:47.817Z","0.1.0":"2021-06-01T12:04:48.121Z","modified":"2022-04-04T17:15:14.184Z","0.1.1":"2021-06-01T13:29:33.633Z","0.1.2":"2021-06-01T14:11:12.588Z","0.1.3":"2021-06-07T10:06:06.645Z"},"maintainers":[{"name":"ayushn21","email":"ayush@hey.com"}],"description":"Extends ActionText to support highlighed code blocks","homepage":"https://github.com/ayushn21/actiontext-syntax-highlighter","repository":{"type":"git","url":"git+https://github.com/ayushn21/actiontext-syntax-highlighter"},"author":{"name":"Ayush Newatia","email":"ayush@hey.com","url":"https://github.com/ayushn21"},"bugs":{"url":"https://github.com/ayushn21/actiontext-syntax-highlighter/issues"},"license":"MIT","readme":"<img width=\"861\" alt=\"screenshot\" src=\"https://user-images.githubusercontent.com/4924039/120343433-9f91bc80-c2f0-11eb-876b-bcb0a977a020.png\">\n\n\n# Description\n\n`actiontext-syntax-highlighter` is an extension for `rails/actiontext` to allow the user to add language specified code blocks that are then highlighted on the server using [Rouge](http://github.com/rouge-ruby/rouge).\n\n[**Check out the demo app to see how it works!**](https://actiontext-syntax-highlighter.herokuapp.com).\n\n> Note: The experience is a bit flaky, especially on Safari. If you have any suggestions for how to improve it, please file an issue; or even better, open a Pull Request! I recommend using Firefox to test this out as that's where it works best!\n\n## How it works\n\nThis library intercepts the toolbar code button in the Trix editor and creates an attachment containing the HTML for an editable code block and language selection dropdown.\n\nThe changes to the code block are saved to the server every time edits are made. When the code block is being rendered out for viewing, it uses Rouge to highlight the content using the language selected in the dropdown; or attempting to guess the language if it's missing.\n\n\n## Installation\n\nInstall ActionText if you haven't already done so:\n\n```shell\n$ bin/rails action_text:install\n```\n\nThen add this gem to your application's Gemfile:\n\n```ruby\ngem 'actiontext-syntax-highlighter', require: 'action_text_syntax_highlighter/engine'\n```\n\nAnd bundle and install it:\n\n```bash\n$ bundle\n$ bin/rails action_text_syntax_highlighter:install\n```\n\nThis will copy the database migrations into place and install the Yarn module for the frontend code.\n\n\n## Usage\n\nAdd the following lines to your `application.js`:\n\n```javascript\nimport { ActionTextSyntaxHighlighter } from \"@ayushn21/actiontext-syntax-highlighter\"\nActionTextSyntaxHighlighter.start()\n```\n\nImport the CSS for a theme from the `themes` directory:\n\n```javascript\nimport \"@ayushn21/actiontext-syntax-highlighter/themes/github.css\"\n```\n\nThe default theme is set to GitHub. If you wish to use another theme, import its CSS file and set the following config option in your `application.rb`:\n\n```ruby\nconfig.action_text_syntax_highlighter.default_theme = :base16\n```\n\nYou can override the default theme by setting `@highlighted_code_block_theme` in your controller action where you're rendering out the rich text.\n\n`ActionTextSyntaxHighlighter` requires a global `Trix` variable to create attachments, so require Trix in your application as below:\n\n```javascript\nwindow.Trix = require(\"trix\")\n```\n\nFinally, add a `data-highlights-code-blocks='true'` attribute to the Trix editor where you'd like to use this plugin:\n\n```erb\n<%= f.rich_text_area :content, data: { highlights_code_blocks: true } %>\n```\n\n### Bundled JavaScript\n\nIf you wish, you can import pre-bundled JavaScript instead of the module as described above:\n\n```javascript\nimport \"@ayushn21/actiontext-syntax-highlighter/dist\"\n```\n\n## Converting existing rich texts\n\nIf you've already code rich texts in your app with code blocks using a `pre` tag, you can use the method `convert_pre_tags_to_highlighted_code_blocks` on `ActionText::RichText` to migrate them over to highlighted code blocks.\n\nFor example:\n\n```ruby\nActionText::RichText.find_each do |rich_text|\n  rich_text.convert_pre_tags_to_highlighted_code_blocks\nend\n```\n\n## Cleaning up deleted code blocks\n\n`ActionTextSyntaxHighlighter` nullifies the `rich_text_id` on a `HighlightedCodeBlock` when it's removed from an `ActionText::RichText`. However it doesn't delete the record. \n\nI recommend you set up a cron job to execute the included `ActionTextSyntaxHighlighter::PurgeDeletedHighlightedCodeBlocksJob` which will delete all `HighlightedCodeBlock`s over a day old without an associated `RichText`.\n\n\n## Contributing\n\n1. Fork it (https://github.com/ayushn21/actiontext-syntax-highlighter/fork)\n2. Clone the fork using `git clone` to your local development machine.\n3. Create your feature branch (`git checkout -b my-new-feature`)\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n\n> If you've made a change to the frontend code, please also run `rake frontend:build` before opening your PR!\n\n## Info\n\nThis gem was extracted from [chapter24.app](https://chapter24.app)\n\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","readmeFilename":"README.md"}