{"id":28963847,"url":"https://github.com/pnezis/fancy_fences","last_synced_at":"2025-06-24T04:12:45.925Z","repository":{"id":184828613,"uuid":"656123612","full_name":"pnezis/fancy_fences","owner":"pnezis","description":"An earmark wrapper that post-processes code fences","archived":false,"fork":false,"pushed_at":"2024-12-10T20:35:31.000Z","size":1950,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-21T03:42:24.282Z","etag":null,"topics":["documentation","elixir","ex-doc","markdown","plugin"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/fancy_fences/readme.html","language":"Elixir","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/pnezis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2023-06-20T09:49:49.000Z","updated_at":"2024-12-10T20:35:35.000Z","dependencies_parsed_at":"2024-06-29T15:23:49.960Z","dependency_job_id":"64296449-785e-46fe-ad4b-a1422c889b62","html_url":"https://github.com/pnezis/fancy_fences","commit_stats":null,"previous_names":["pnezis/fancy_fences"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pnezis/fancy_fences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnezis%2Ffancy_fences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnezis%2Ffancy_fences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnezis%2Ffancy_fences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnezis%2Ffancy_fences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pnezis","download_url":"https://codeload.github.com/pnezis/fancy_fences/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnezis%2Ffancy_fences/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261601525,"owners_count":23183099,"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":["documentation","elixir","ex-doc","markdown","plugin"],"created_at":"2025-06-24T04:12:44.992Z","updated_at":"2025-06-24T04:12:45.911Z","avatar_url":"https://github.com/pnezis.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FancyFences\n\n[![Actions Status](https://github.com/pnezis/fancy_fences/actions/workflows/elixir.yml/badge.svg)](https://github.com/pnezis/fancy_fences/actions)\n[![Package](https://img.shields.io/badge/-Package-important)](https://hex.pm/packages/fancy_fences)\n[![Documentation](https://img.shields.io/badge/-Documentation-blueviolet)](https://hexdocs.pm/fancy_fences)\n\n`FancyFences` is a markdown processor on top of [`EarmarkParser`](https://github.com/pragdave/earmark)\n(the default markdown processor used by [`ExDoc`](https://github.com/elixir-lang/ex_doc).\nYou can use it to conditionally post-process code blocks allowing you to:\n\n- Ensure that the code examples are valid\n- Format code blocks\n- Evaluate code blocks and include the output in the documenation, for example\nyou can:\n  - add the `inspect` ouptut of a code block in order to have up to date code\n  samples in your docs\n  - auto-generate vega-lite or mermaid plots\n  - use it instead of interplation for evaluating functions within the current module.\n\n![mermaid example](https://github.com/pnezis/fancy_fences/raw/main/assets/mermaid.png)\n\n## Usage\n\nIn order to use `FancyFences` you need to set the `:markdown_processor` option\nin the `:docs` section as following:\n\n```elixir\ndocs: [\n  markdown_processor: {FancyFences, [fences: processors]}\n]\n```\n\nwhere `processors` defines the code blocks processors.\n\n```elixir\ndocs: [\n  markdown_processor: {FancyFences, [fences: fancy_processors()]}\n]\n\ndefp fancy_processors do\n  %{\n    \"format\" =\u003e {FancyFences.Processors, :format_code, []},\n    \"inspect\" =\u003e {FancyFences.Processors, :inspect_code, [format: true]},\n    \"vl\" =\u003e {MyProcessors, :vega_lite, []},\n    \"mermaid\" =\u003e {MyProcessors, :mermaid, []}\n  }\nend\n```\n\nwill apply the following processors:\n\n- Each `format` code block will be post-processed using the `FancyFences.Processors.format_code/1`\nwhich will format the inline code.\n- Each `inspect` code block will be post-processed using the `FancyFences.Processors.inspect_code/2`\nwhich will replace the existing code block with two blocks:\n  - An `:elixir` code block including the initial code\n  - A second `:elixir` block with the output of the evaluation of the first block.\n- Each `vl` block will apply a custom processor that evaluates the inline code\nblock and replaces it with the original block and the evaluated vega-lite spec.\nYou can see such a processor used throughout [`Tucan` docs](https://hexdocs.pm/tucan/Tucan.html)\n- Similarly for the mermaid blocks.\n\nNow in your markdown docs you can use the above processors as language and `fancy_fences`\nwill apply the required transformations during `mix docs` invocation.\n\n### Examples\n\n`inspect` fence processor example:\n\n![inspect example](https://github.com/pnezis/fancy_fences/raw/main/assets/inspect.png)\n\n`vl` fence processor example:\n\n![vega-lite example](https://github.com/pnezis/fancy_fences/raw/main/assets/vl.png)\n\n### Example project\n\nYou can find a sample project [using `fancy_fences` here](https://github.com/pnezis/fancy_fences_example).\n\n## Installation\n\nIn order to install the package add the following to your `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:fancy_fences, \"~\u003e 0.3.0\", only: :dev, runtime: false}\n  ]\nend\n```\n\nand configure your fence processors accoring to the [docs](https://hexdocs.pm/fancy_fences).\n\n## License\n\nCopyright (c) 2023 Panagiotis Nezis\n\n`fancy_fences` is released under the MIT License. See the [LICENSE](LICENSE) file\nfor more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnezis%2Ffancy_fences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpnezis%2Ffancy_fences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnezis%2Ffancy_fences/lists"}