{"id":15512186,"url":"https://github.com/bridgetownrb/bridgetown-mdjs","last_synced_at":"2025-04-13T17:07:45.894Z","repository":{"id":62554587,"uuid":"344884023","full_name":"bridgetownrb/bridgetown-mdjs","owner":"bridgetownrb","description":"Kramdown-based support for Markdown JavaScript (mdjs) in Bridgetown","archived":false,"fork":false,"pushed_at":"2024-10-20T06:26:42.000Z","size":29,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T17:07:38.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bridgetownrb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-05T17:25:53.000Z","updated_at":"2024-10-20T06:26:56.000Z","dependencies_parsed_at":"2022-11-03T05:00:42.463Z","dependency_job_id":null,"html_url":"https://github.com/bridgetownrb/bridgetown-mdjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bridgetownrb%2Fbridgetown-mdjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bridgetownrb%2Fbridgetown-mdjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bridgetownrb%2Fbridgetown-mdjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bridgetownrb%2Fbridgetown-mdjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bridgetownrb","download_url":"https://codeload.github.com/bridgetownrb/bridgetown-mdjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750109,"owners_count":21155686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridgetown","bridgetown-plugin","kramdown","markdown"],"created_at":"2024-10-02T09:53:30.663Z","updated_at":"2025-04-13T17:07:45.870Z","avatar_url":"https://github.com/bridgetownrb.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# bridgetown-mdjs\n\n\u003e [!WARNING]\n\u003e This plugin is considered \"as-is\" and I don't anticpate developing it any further. If you submit an interesting PR, I'm willing to merge it, but otherwise…it's done.\n\n----\n\nA [Bridgetown](https://www.bridgetownrb.com) plugin to add Kramdown-based support for [Markdown JavaScript (mdjs)](https://rocket.modern-web.dev/docs/markdown-javascript/overview/).\n\nmdjs is a format which allows you to write executable JavaScript from within Markdown files. The mdjs-compatible parser will extract any fenced code block marked as `js script` and later include the extraction(s) within a `\u003cscript type=\"module\"\u003e` tag at the bottom of the page layout. This means you can import libraries and web components and define various bits of JS inline with your Markdown content.\n\n(**Note:** While the mdjs support in Rocket includes stories and HTML component previews, in this initial release for Bridgetown we're only supporting the basic JavaScript code extractions.)\n\n_Requires Bridgetown 0.21 or higher._\n\n## Installation\n\nRun this command to add this plugin to your site's Gemfile:\n\n```shell\n$ bundle add bridgetown-mdjs -g bridgetown_plugins\n```\n\nThen add either a Liquid tag or Ruby helper to your default layout right below the main content.\n\n```html\n\u003c!-- Liquid --\u003e\n\u003cmain\u003e\n   {{ content }}\n   {% mdjs_script %}\n\u003c/main\u003e\n\n\u003c!-- ERB --\u003e\n\u003cmain\u003e\n  \u003c%= yield %\u003e\n  \u003c%= mdjs_script %\u003e\n\u003c/main\u003e\n```\n\n## Usage\n\nThe plugin will perform the necessary extractions (via the [kramdown-parser-gfm-extractions](https://github.com/bridgetownrb/kramdown-parser-gfm-extractions) add-on) to any Markdown file in your Bridgetown site.\n\nHere's an example Markdown file where you can see mdjs in action:\n\n~~~markdown\n# Introducing mdjs\n\nLet's import some components from Skypack!\n\n```js script\nimport SlIcon from \"https://cdn.skypack.dev/@shoelace-style/shoelace/dist/components/icon/icon.js\"\nimport SlIconButton from \"https://cdn.skypack.dev/@shoelace-style/shoelace/dist/components/icon-button/icon-button.js\"\nimport { setBasePath } from \"https://cdn.skypack.dev/@shoelace-style/shoelace/dist/utilities/base-path.js\"\n\nsetBasePath(\"https://cdn.skypack.dev/@shoelace-style/shoelace/dist\")\n```\n\n## Hello from Shoelace!\n\n\u003csl-icon-button name=\"emoji-smile\" label=\"Yo!\"\u003e\u003c/sl-icon-button\u003e\n\nAnd it's easy to change the DOM…\n\n\u003caside id=\"hey-hey\"\u003e\u003c/aside\u003e\n\n```js script\ndocument.querySelector(\"#hey-hey\").innerHTML = \"\u003cp\u003eYou you!\u003c/p\u003e\"\n```\n~~~\n\n### Optional configuration options\n\nBy default, extraction tags (inert, using `template`) aren't included in the rendered output HTML. You can change those options inside the `kramdown` namespace in `bridgetown.config.yml`. See [kramdown-parser-gfm-extractions](https://github.com/bridgetownrb/kramdown-parser-gfm-extractions) README for further details.\n\n## Testing\n\n* Run `bundle exec rake test` to run the test suite\n* Run `rubocop` to check for any style offenses.\n\n## Releasing\n\n* Run `bundle exec rake test_and_release` to verify rubocop and tests before releasing a new gem.\n\n## Contributing\n\n1. Fork it (https://github.com/bridgetownrb/bridgetown-mdjs/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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbridgetownrb%2Fbridgetown-mdjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbridgetownrb%2Fbridgetown-mdjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbridgetownrb%2Fbridgetown-mdjs/lists"}