{"id":19842888,"url":"https://github.com/deemp/lima","last_synced_at":"2026-05-08T06:04:07.847Z","repository":{"id":169820705,"uuid":"623586806","full_name":"deemp/lima","owner":"deemp","description":"Convert between Haskell, Literate Haskell, Markdown, TeX","archived":false,"fork":false,"pushed_at":"2023-10-06T00:39:42.000Z","size":756,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T11:47:30.942Z","etag":null,"topics":["haskell","latex","markdown"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/lima","language":"Haskell","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/deemp.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}},"created_at":"2023-04-04T17:07:20.000Z","updated_at":"2023-07-18T09:25:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"1e47b2e8-e5b0-4470-b5f1-afddeb7f5ea5","html_url":"https://github.com/deemp/lima","commit_stats":null,"previous_names":["deemp/lima"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deemp%2Flima","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deemp%2Flima/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deemp%2Flima/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deemp%2Flima/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deemp","download_url":"https://codeload.github.com/deemp/lima/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241214033,"owners_count":19928228,"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":["haskell","latex","markdown"],"created_at":"2024-11-12T12:35:56.392Z","updated_at":"2026-05-08T06:04:02.816Z","avatar_url":"https://github.com/deemp.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lima\n\nSync your `README` with your `Haskell` codebase.\n\n## Supported formats\n\nConvert files between:\n\n- `Haskell` (`.hs`)\n- `Literate Haskell` (`.lhs`)\n- `GitHub Flavored Markdown` (`.md`)\n- `TeX` (`.tex`)\n\n## Related works\n\n- [LiterateMarkdown](https://hackage.haskell.org/package/LiterateMarkdown) - `lima` is a fork of this abandoned project.\n\n- [pandoc](https://hackage.haskell.org/package/pandoc) - [supports](https://www.uv.es/wikibase/doc/cas/pandoc_manual_instalado.wiki?60) `Literate Haskell` and a ton of other formats.\n\n- [IHaskell](https://hackage.haskell.org/package/ihaskell) - create `Jupyter` notebooks with `Haskell` code cells and `GitHub Flavored Markdown` text cells.\n\n- [lhs2tex](https://hackage.haskell.org/package/lhs2tex) - convert `Literate Haskell` to `TeX`.\n\n- [agda2lagda](https://hackage.haskell.org/package/agda2lagda) - Generate a literate Agda/Haskell script from an Agda/Haskell script. Produces LaTeX or Markdown literate scripts.\n\n- [markdown-unlit](https://hackage.haskell.org/package/markdown-unlit) - `markdown-unlit` is a custom unlit program. It can be used to extract Haskell code from Markdown files.\n\n- [unlit](https://hackage.haskell.org/package/unlit) - Tool to convert literate code between styles or to code.\n\n- [design-tools](https://github.com/isovector/design-tools) - a Pandoc filter for building a book from Markdown.\n\n- [literatex](https://hackage.haskell.org/package/literatex) - transform literate source code to Markdown\n\n## Scope\n\n`lima` focuses on converting documents between formats and allows to concatenate documents.\n\nOther scenarios, e.g., inlining a document into a document, may require specialized tools.\n\n## Demo\n\n### Markdown\n\n[.hs](./testdata/md/test.hs) and [.md](./testdata/md/test.md)\n\n![demo](https://raw.githubusercontent.com/deemp/lima/main/README/md-demo-hs-md-preview.png)\n\n### TeX\n\n[.hs](./testdata/tex/test.hs) and [.lhs](./testdata/tex/test.lhs) and [.tex](./testdata/tex/test.tex)\n\n![demo](https://raw.githubusercontent.com/deemp/lima/main/README/tex-demo-hs-lhs-tex.png)\n\n## Ideas\n\n- A document is a text in a supported format.\n- I introduced tags into supported formats.\n  - E.g., in `.hs` documents, tags are multiline comments written on a single line like '`{- LIMA_ENABLE -}`'.\n- Tag names are configurable.\n  - A user may set '`on`' instead of '`LIMA_ENABLE`'.\n- A document can be parsed into a list of tokens.\n- Tags affect document parsing.\n- The tokens can be printed back to that document.\n- Formatting a document is printing a parsed document back to itself.\n  - Formatting is idempotent. In other words, formatting the document again won't change its content.\n- The `lima` library provides a parser and a printer for each supported format.\n- A composition of a printer after a parser produces a converter.\n- Such a converter is usually invertible for a formatted document.\n  - Converting a document `A` to a document `B`, then converting `B` to `A` doesn't change the content of `A`.\n\n## Suggested setup\n\n1. Create a test suite. `README.hs` may be its main file.\n1. Add `lima` and `text` to its dependencies.\n1. Create a test module. It may have the following content.\n\n    \u003c!-- LIMA_INDENT 4 --\u003e\n\n    ```haskell\n    import Lima.Converter (Format (..), convertTo, def)\n    import Data.Text.IO qualified as T\n    \n    main :: IO ()\n    main = T.readFile \"README.hs\" \u003e\u003e= T.writeFile \"README.md\" . (Hs `convertTo` Md) def\n    ```\n\n\u003c!-- LIMA_DEDENT --\u003e\n\nThis package has three such test suites:\n\n- [readme](README.hs) converts `README.hs` to `README.md`. `README.hs` is its main file.\n- [readme-hs-to-md](test/HsToMd/Main.hs) converts `README.hs` to `README.md`.\n- [readme-md-to-hs](test/MdToHs/Main.hs) converts `README.md` to `README.hs`.\n\n## Suggested workflow\n\nHere's a suggested workflow for `Haskell` and `Markdown`:\n\n1. Edit the code in a `README.hs` using [Haskell Language Server](https://github.com/haskell/haskell-language-server).\n1. Convert `README.hs` to a `README.md`. Comments from `README.hs` become text in `README.md`.\n1. Edit the text in `README.md` using [markdownlint](https://github.com/DavidAnson/markdownlint).\n1. Convert `README.md` back to the `README.hs` to keep files in sync. Text from `README.md` becomes comments in `README.hs`.\n1. Repeat.\n\n## Contribute\n\nClone this repo and enter `lima`.\n\n```console\ngit clone https://github.com/deemp/lima\ncd lima\n```\n\n### cabal\n\nBuild\n\n```console\ncabal update\ncabal build\n```\n\n### nix\n\n1. [Install](https://github.com/deemp/flakes/blob/main/README/InstallNix.md) `Nix`.\n\n1. Run a devshell and build `lima` using the project's `cabal`:\n\n    ```console\n    nix develop nix-dev/\n    cabal build\n    ```\n\n1. Optionally, start `VSCodium`:\n\n    ```console\n    nix run nix-dev/#writeSettings\n    nix run nix-dev/#codium .\n    ```\n\n1. Open a `Haskell` file there, hover over a term and wait until `HLS` shows hints.\n\n1. [Troubleshoot](https://github.com/deemp/flakes/blob/main/README/Troubleshooting.md) if necessary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeemp%2Flima","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeemp%2Flima","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeemp%2Flima/lists"}