# Frustrated at WXME files in git repositories? Set a filter!

**URL:** <https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568>\
**Category:** Show & Tell\
**Created:** [December 2, 2023, 5:40am UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568 "2023-12-02T05:40:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [December 2, 2023, 5:40am UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568/1 "2023-12-02T05:40:38Z")

</div>

Having WXME files in git repositories can be frustrating. They are not readable in other editors. Git can't display them in `git diff` and `git show`. But don't give up yet! [Git supports custom filters](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes) that allows one to customize conversion from binary files to text, which can generate useful outputs when working with binary files. Some git implementation already [include](https://github.com/git-for-windows/build-extra/blob/c223c7757745c1df552c0dd4628c368aaea11f32/git-extra/gitattributes#L13)such [configurations](https://github.com/git-for-windows/build-extra/blob/c223c7757745c1df552c0dd4628c368aaea11f32/git-extra/gitconfig#L11-L12) for [PDFs](https://github.com/git-for-windows/build-extra/blob/c223c7757745c1df552c0dd4628c368aaea11f32/git-extra/astextplain#L27-L29). Let's add one for WXME files.

1. Create this `racket-wxme-astext` script and make it available in your `$PATH`. When the specified file is identified as a binary file, it uses `wxme-port->text-port` to extract readable texts from WXME files. Remember to `chmod u+x racket-wxme-astext`.

2. Identify Racket files in GIT attributes. Add this line to either `<PROJECT_ROOT>/.gitattributes`, `<PROJECT_ROOT>/.git/info/attributes` or [`$XDG_CONFIG_HOME/git/attributes`](https://git-scm.com/docs/gitattributes):

3. Hook `racket-wxme-astext` for `wxme` type in git:

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [December 2, 2023, 1:35pm UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568/2 "2023-12-02T13:35:43Z")

</div>

Screenshot?

Filler to get to 20 characters.

---

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [December 2, 2023, 9:43pm UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568/3 "2023-12-02T21:43:32Z")

</div>

Here is one! Actually, just running `racket-wxme-astext FILE.rkt` directly extracts the text content from `FILE.rkt`.

This screenshot contains a comment box and a fraction. Note that because the WXME library renders images as `.`, there's no way to show diff for images (not even hashes).

 ![Screenshot of DrRacket editing a WXME file and a terminal showing its outputs](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/6/6a16c9faba133cd0883d8ce381ac819a75035803.jpeg)

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [December 2, 2023, 11:32pm UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568/4 "2023-12-02T23:32:26Z")

</div>

Is it only locally you get the nice diffs - I mean - how does it look on Github?

---

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [December 3, 2023, 1:48am UTC](https://racket.discourse.group/t/frustrated-at-wxme-files-in-git-repositories-set-a-filter/2568/5 "2023-12-03T01:48:34Z")

</div>

It does not work on GitHub. As it turns out, diffing WXME actually depends on running Racket code.
