{"id":24840201,"url":"https://github.com/pzingg/diff_match_patch","last_synced_at":"2025-06-10T14:35:23.004Z","repository":{"id":50545629,"uuid":"519028256","full_name":"pzingg/diff_match_patch","owner":"pzingg","description":"An Elixir implementation of the Google diff_match_patch library","archived":false,"fork":false,"pushed_at":"2025-01-24T22:41:30.000Z","size":380,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T15:50:05.062Z","etag":null,"topics":["diff","diff-match-patch","elixir","match","patch","text-processing"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pzingg.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-07-29T00:10:13.000Z","updated_at":"2024-12-04T02:31:29.000Z","dependencies_parsed_at":"2025-01-24T21:29:49.545Z","dependency_job_id":null,"html_url":"https://github.com/pzingg/diff_match_patch","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/pzingg%2Fdiff_match_patch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzingg%2Fdiff_match_patch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzingg%2Fdiff_match_patch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzingg%2Fdiff_match_patch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pzingg","download_url":"https://codeload.github.com/pzingg/diff_match_patch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzingg%2Fdiff_match_patch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259093357,"owners_count":22804163,"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":["diff","diff-match-patch","elixir","match","patch","text-processing"],"created_at":"2025-01-31T06:55:24.667Z","updated_at":"2025-06-10T14:35:22.974Z","avatar_url":"https://github.com/pzingg.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diff_match_patch\n\nA translation of Google's public-domain\n[diff_match_patch](https://github.com/google/diff-match-patch) code into pure Elixir.\n\nFor information about the original Google project and its application,\nsee that repository's [wiki pages](https://github.com/google/diff-match-patch/wiki).\n\nReferences from the Google project:\n\n* diff: [An O(ND) Difference Algorithm and Its Variations (Meyers, 1986)](http://www.xmailserver.org/diff2.pdf)\n* match: [Fast Text Searching with Errors (Wu and Manber, 1991)](http://www.club.cc.cmu.edu/~ajo/docs/agrep.pdf)\n\nPrior art on the BEAM:\n\n* diffy: [A Diff, Match and Patch implementation for Erlang](https://github.com/zotonic/diffy)\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `diff_match_patch` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:diff_match_patch, \"~\u003e 0.2.0\"}\n  ]\nend\n```\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at \u003chttps://hexdocs.pm/cursor\u003e.\n\n## Usage\n\n1. Find a **match** for a pattern inside at text using fuzzy search. The\n`match_threshold` option determines the exactness required:\n\n```\nloc = Dmp.Match.main(\n    \"I am the very model of a modern major general.\",\n    \" that berry \",\n    5,\n     match_threshold: 0.7)\n```\n\nThe value of `loc` is 4, finding the closest match at the string starting \" the very\".\nIf no close match is found, the `loc` returned is -1.\n\n2. Create a **diff** between two texts:\n\n```\ndiffs = Dmp.Diff.main(\n    \"The quick brown fox jumps over the lazy dog.\",\n    \"That quick brown fox jumped over a lazy dog.\")\n```\n\n3. Create a **patch** from the the original text and the diff we just created.\nThe patch can also be created directly from the two texts. These\ntwo patches are equal:\n\n```\npatches1 = Dmp.Patch.make(\n    \"The quick brown fox jumps over the lazy dog.\", diffs)\npatches2 = Dmp.Patch.make(\n    \"The quick brown fox jumps over the lazy dog.\",\n    \"That quick brown fox jumped over a lazy dog.\")\n```\n\n4. Apply the patch to a third text:\n\n```\n{new_text, matched} = Patch.apply(patches, \"The quick red rabbit jumps over the tired tiger.\")\nIO.puts(new_text)\n```\n\nThe `new_text` prints out as \"That quick red rabbit jumped over a tired tiger.\"\nThe `matched` value is a list of booleans, showing whether the results of whether\nmatches were made between the (expanded) list of patches and the third text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzingg%2Fdiff_match_patch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpzingg%2Fdiff_match_patch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzingg%2Fdiff_match_patch/lists"}