{"id":13509215,"url":"https://github.com/MainShayne233/markdown_test","last_synced_at":"2025-03-30T13:31:47.056Z","repository":{"id":57520975,"uuid":"221571992","full_name":"MainShayne233/markdown_test","owner":"MainShayne233","description":"Test the Elixir code in your markdown files!","archived":false,"fork":false,"pushed_at":"2019-12-05T17:48:17.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T10:19:44.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/MainShayne233.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}},"created_at":"2019-11-13T23:37:55.000Z","updated_at":"2020-01-12T19:14:25.000Z","dependencies_parsed_at":"2022-09-26T18:01:07.159Z","dependency_job_id":null,"html_url":"https://github.com/MainShayne233/markdown_test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainShayne233%2Fmarkdown_test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainShayne233%2Fmarkdown_test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainShayne233%2Fmarkdown_test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MainShayne233%2Fmarkdown_test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MainShayne233","download_url":"https://codeload.github.com/MainShayne233/markdown_test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246323936,"owners_count":20759052,"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":[],"created_at":"2024-08-01T02:01:04.668Z","updated_at":"2025-03-30T13:31:46.652Z","avatar_url":"https://github.com/MainShayne233.png","language":"Elixir","funding_links":[],"categories":["Testing"],"sub_categories":[],"readme":"# MarkdownTest\n\n[![Build Status](https://secure.travis-ci.org/MainShayne233/markdown_test.svg?branch=master \"Build Status\")](http://travis-ci.org/MainShayne233/markdown_test)\n[![Coverage Status](https://coveralls.io/repos/github/MainShayne233/markdown_test/badge.svg?branch=master)](https://coveralls.io/github/MainShayne233/markdown_test?branch=master)\n[![Hex Version](http://img.shields.io/hexpm/v/markdown_test.svg?style=flat)](https://hex.pm/packages/markdown_test)\n\nTest the Elixir code in your markdown!\n\n## Usage\n\nAdd `:markdown_test` as a dependency in your `mix.exs` file:\n\n```elixir\n# mix.exs\n\ndefp deps do\n  [\n    {:markdown_test, \"0.1.2\", only: :test}\n  ]\nend\n```\n\nIn any test module, `use MarkdownTest` to pull in the `test_markdown/1` macro and call it for your markdown file:\n\n```elixir\ndefmodule MyLibraryTest do\n  use MarkdownTest\n\n  test_markdown(\"README.md\")\nend\n```\n\nThen add some Elixir code to test in your markdown file.\n\nThe format roughly resembles that of a [`doctest`](https://elixir-lang.org/getting-started/mix-otp/docs-tests-and-with.html).\n\nIn order to be picked up, a code block must be between the following markdown comment tags:\n\n`\u003c!--- MARKDOWN_TEST_START --\u003e`\n\n...code\n\n`\u003c!--- MARKDOWN_TEST_END --\u003e`.\n\n### Examples\n\n\u003c!--- MARKDOWN_TEST_START --\u003e\n```elixir\niex\u003e 1 + 2\n3\n```\n\u003c!--- MARKDOWN_TEST_END --\u003e\n\nThe expression and expected values can span multiple lines:\n\n\u003c!--- MARKDOWN_TEST_START --\u003e\n```elixir\niex\u003e a = %{cool: :beans}\n...\u003e b = %{beans: :cool}\n...\u003e Map.merge(a, b)\n%{\n  cool: :beans,\n  beans: :cool\n}\n```\n\u003c!--- MARKDOWN_TEST_END --\u003e\n\nYou can also include any setup code that needs to be run prior to testing the code:\n\n\u003c!--- MARKDOWN_TEST_START --\u003e\n```elixir\ndefmodule MyModule do\n  def add(x, y), do: x + y\nend\n\niex\u003e MyModule.add(1, 2)\n3\n```\n\u003c!--- MARKDOWN_TEST_END --\u003e\n\n`markdown_test` will assert that the expression and the expected value match according to [Elixir's pattern matching](https://elixir-lang.org/getting-started/pattern-matching.html).\n\nTherefore, you can write a test like this:\n\n\u003c!--- MARKDOWN_TEST_START --\u003e\n```elixir\ndefmodule MyModule do\n  def big_result do\n    {:ok, List.duplicate(\"hey\", 1000)}\n  end\nend\n\niex\u003e MyModule.big_result()\n{:ok, [\"hey\" | _]}\n```\n\u003c!--- MARKDOWN_TEST_END --\u003e\n\n\nIf you don't add any assertion code, `markdown_test` will just verify that the code snippet compiles, like:\n\n\u003c!--- MARKDOWN_TEST_START --\u003e\n```elixir\n%{\n  this: %{\n    \"should\" =\u003e :compile\n  }\n}\n```\n\u003c!--- MARKDOWN_TEST_END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMainShayne233%2Fmarkdown_test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMainShayne233%2Fmarkdown_test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMainShayne233%2Fmarkdown_test/lists"}