{"id":15016579,"url":"https://github.com/idris-maps/code-blocks","last_synced_at":"2025-04-12T09:32:20.319Z","repository":{"id":39601131,"uuid":"282322554","full_name":"idris-maps/code-blocks","owner":"idris-maps","description":"Use markdown code blocks to render: charts, graphviz diagrams, MathML, music sheets, HTML tables and highlight code.","archived":false,"fork":false,"pushed_at":"2023-03-06T07:40:33.000Z","size":4051,"stargazers_count":11,"open_issues_count":34,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-04T11:06:10.397Z","etag":null,"topics":["codeblocks","eleventy","markdown","rehype"],"latest_commit_sha":null,"homepage":"https://code-blocks.surge.sh/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idris-maps.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-24T21:52:45.000Z","updated_at":"2023-02-27T02:56:57.000Z","dependencies_parsed_at":"2024-10-05T16:00:57.833Z","dependency_job_id":"e8fa8961-16c4-41cd-8df8-f1d93e350f8f","html_url":"https://github.com/idris-maps/code-blocks","commit_stats":{"total_commits":73,"total_committers":3,"mean_commits":"24.333333333333332","dds":0.1095890410958904,"last_synced_commit":"759dc1969d1cb31651999897bf0992ffbe5e284e"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fcode-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fcode-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fcode-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fcode-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idris-maps","download_url":"https://codeload.github.com/idris-maps/code-blocks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223510342,"owners_count":17157306,"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":["codeblocks","eleventy","markdown","rehype"],"created_at":"2024-09-24T19:49:06.193Z","updated_at":"2024-11-07T12:04:10.852Z","avatar_url":"https://github.com/idris-maps.png","language":"TypeScript","readme":"# @code-blocks\n\nUse markdown code blocks to render:\n\n* [Charts](https://github.com/idris-maps/code-blocks/tree/master/packages/charts) \n* [Graphviz diagrams](https://github.com/idris-maps/code-blocks/tree/master/packages/graphviz)\n* [MathML](https://github.com/idris-maps/code-blocks/tree/master/packages/math)\n* [Music sheets](https://github.com/idris-maps/code-blocks/tree/master/packages/music)\n* [HTML tables](https://github.com/idris-maps/code-blocks/tree/master/packages/tables)\n\nand [highlight code](https://github.com/idris-maps/code-blocks/tree/master/packages/prism).\n\n`@code-blocks` can be used either as a [rehype](https://github.com/rehypejs/rehype) transform or as an [eleventy](https://www.11ty.dev/) plugin.\n\n## Example\n\nA code block with `music-abc` as language and the following content:\n\n```\nDDAA|BBA2|\n```\n\nwill be rendered as:\n\n![Music sheet example](https://raw.githubusercontent.com/idris-maps/code-blocks/master/assets/home-example.png)\n\n## Usage with [rehype](https://github.com/rehypejs/rehype)\n\nInstall the transform:\n\n```bash\nnpm install @code-blocks/rehype-transform --save\n```\n\nInstall the renderers you need, for example:\n\n```bash\nnpm install @code-blocks/charts --save\n```\n\nAn use it:\n\n```js\nconst unified = require('unified')\nconst stream = require('unified-stream')\nconst markdown = require('remark-parse')\nconst remark2rehype = require('remark-rehype')\nconst html = require('rehype-stringify')\n\n// the rehype transform\nconst codeblocks = require('@code-blocks/rehype-transform')\n\n// some renderers\nconst charts = require('@code-blocks/charts')\nconst graphviz = require('@code-blocks/graphviz')\n\nconst processor = unified()\n  .use(markdown)\n  .use(remark2rehype)\n  // add the transform and the renderers in an array as options\n  .use(codeblocks, [charts, graphviz])\n  .use(html)\n\nprocess.stdin.pipe(stream(processor)).pipe(process.stdout)\n```\n\n## Usage with [eleventy](https://www.11ty.dev/)\n\nInstall the plugin:\n\n```bash\nnpm install @code-blocks/eleventy-plugin --save\n```\n\nInstall the renderers you need, for example:\n\n```bash\nnpm install @code-blocks/music --save\n```\n\n\nIn the `.eleventy.js` configuration file:\n\n```js\n// the plugin\nconst codeblocks = require('@code-blocks/eleventy-plugin')\n\n// some renderers\nconst math = require('@code-blocks/math')\nconst music = require('@code-blocks/music')\n\nmodule.exports = function(eleventyConfig) {\n  // pass the renderers to the plugin\n  eleventyConfig.addPlugin(codeblocks([\n    math,\n    music,\n  ]))\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidris-maps%2Fcode-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidris-maps%2Fcode-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidris-maps%2Fcode-blocks/lists"}