Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- uses: erlef/setup-beam@v1
with:
otp-version: "26.0.2"
gleam-version: "1.5.1"
gleam-version: "1.11.1"
rebar3-version: "3"
# elixir-version: "1.15.4"
- run: gleam deps download
- run: gleam build --warnings-as-errors
- run: gleam test
- run: gleam format --check src test
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v2.0.0 - 2025-08-02

This is a complete rewrite. Instead of checking or running gleam code via checkmark,
checkmark can now either check that a snippet matches the content in a file,
or update the markdown file with the content.

Dependencies have also been simplified, and the parsing of the markdown file
no longer uses the package it used to, as it had some issues in it,
and doesn't seem to be actively maintained.

## v1.0.0 - 2024-11-25

### Added
Expand All @@ -10,4 +20,4 @@

## v0.1.0 - 2024-11-10

Initial release
Initial release
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,38 @@
[![Package Version](https://img.shields.io/hexpm/v/checkmark)](https://hex.pm/packages/checkmark)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/checkmark/)

Checkmark is a library for checking that gleam code in markdown files
type checks, builds, or runs successfully.
Checkmark is a library for either checking that code in markdown files
matches content in files, or to automatically update it.

## Example

```sh
gleam add checkmark
gleam add simplifile
gleam add envoy
```

```gleam
import checkmark
import gleam/string

pub fn main() {
// Checks that a single gleam code block in README.md that starts with "import"
// passes type checks, by creating the temporary file `checkmark_tmp.gleam`
// Checking in a temporary project is also supported.
checkmark.new()
|> checkmark.snippets_in("README.md")
|> checkmark.filtering(string.starts_with(_, "import"))
|> checkmark.check_in_current_package("checkmark_tmp.gleam")
|> checkmark.print_failures(panic_if_failed: True)
import envoy
import simplifile

pub fn example_test() {
assert checkmark.new(simplifile.read, simplifile.write)
|> checkmark.file("README.md")
|> checkmark.should_contain_contents_of("./example.sh", tagged: "sh")
|> checkmark.should_contain_contents_of(
"./test/example_test.gleam",
tagged: "gleam",
)
// Update locally, check on CI
|> checkmark.check_or_update(
when: envoy.get("GITHUB_WORKFLOW") == Error(Nil),
)
== Ok(Nil)
}
```

Note that you could assert the results from `check_in...` functions,
but on Erlang, you will most probably get very ugly output.
`print_failures` will pretty-print the failures to stderr and panic if requested.
These examples are, in fact, kept up to date and checked using checkmark!

Further documentation can be found at <https://hexdocs.pm/checkmark>.
3 changes: 3 additions & 0 deletions example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gleam add checkmark
gleam add simplifile
gleam add envoy
12 changes: 5 additions & 7 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "checkmark"
version = "1.0.0"
version = "2.0.0"

description = "Gleam markdown snippet validator"
licences = ["Apache-2.0"]
Expand All @@ -8,12 +8,10 @@ internal_modules = ["test_overwrite"]

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
kirala_markdown = ">= 1.0.2 and < 2.0.0"
simplifile = ">= 2.2.0 and < 3.0.0"
temporary = ">= 1.0.0 and < 2.0.0"
shellout = ">= 1.6.0 and < 2.0.0"
filepath = ">= 1.0.0 and < 2.0.0"
exception = ">= 2.0.0 and < 3.0.0"
splitter = ">= 1.0.0 and < 2.0.0"

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
simplifile = ">= 2.2.0 and < 3.0.0"
gleam_erlang = ">= 1.2.0 and < 2.0.0"
envoy = ">= 1.0.2 and < 2.0.0"
23 changes: 9 additions & 14 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@

packages = [
{ name = "envoy", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "95FD059345AA982E89A0B6E2A3BF1CF43E17A7048DCD85B5B65D3B9E4E39D359" },
{ name = "exception", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "F5580D584F16A20B7FCDCABF9E9BE9A2C1F6AC4F9176FA6DD0B63E3B20D450AA" },
{ name = "filepath", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "67A6D15FB39EEB69DD31F8C145BB5A421790581BD6AA14B33D64D5A55DBD6587" },
{ name = "gleam_crypto", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "8AE56026B3E05EBB1F076778478A762E9EB62B31AEEB4285755452F397029D22" },
{ name = "gleam_stdlib", version = "0.43.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "69EF22E78FDCA9097CBE7DF91C05B2A8B5436826D9F66680D879182C0860A747" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "kirala_markdown", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "kirala_markdown", source = "hex", outer_checksum = "A3E1578F5C33540087902BE54831F653AED2ABD2ACDDE498ADCA7AA3A7EEE7CC" },
{ name = "shellout", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "E2FCD18957F0E9F67E1F497FC9FF57393392F8A9BAEAEA4779541DE7A68DD7E0" },
{ name = "simplifile", version = "2.2.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0DFABEF7DC7A9E2FF4BB27B108034E60C81BEBFCB7AB816B9E7E18ED4503ACD8" },
{ name = "temporary", version = "1.0.0", build_tools = ["gleam"], requirements = ["envoy", "exception", "filepath", "gleam_crypto", "gleam_stdlib", "simplifile"], otp_app = "temporary", source = "hex", outer_checksum = "51C0FEF4D72CE7CA507BD188B21C1F00695B3D5B09D7DFE38240BFD3A8E1E9B3" },
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
{ name = "gleam_erlang", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "F91CE62A2D011FA13341F3723DB7DB118541AAA5FE7311BD2716D018F01EF9E3" },
{ name = "gleam_stdlib", version = "0.62.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "DC8872BC0B8550F6E22F0F698CFE7F1E4BDA7312FDEB40D6C3F44C5B706C8310" },
{ name = "gleeunit", version = "1.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "FDC68A8C492B1E9B429249062CD9BAC9B5538C6FBF584817205D0998C42E1DAC" },
{ name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" },
{ name = "splitter", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "128FC521EE33B0012E3E64D5B55168586BC1B9C8D7B0D0CA223B68B0D770A547" },
]

[requirements]
exception = { version = ">= 2.0.0 and < 3.0.0" }
filepath = { version = ">= 1.0.0 and < 2.0.0" }
envoy = { version = ">= 1.0.2 and < 2.0.0" }
gleam_erlang = { version = ">= 1.2.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
kirala_markdown = { version = ">= 1.0.2 and < 2.0.0" }
shellout = { version = ">= 1.6.0 and < 2.0.0" }
simplifile = { version = ">= 2.2.0 and < 3.0.0" }
temporary = { version = ">= 1.0.0 and < 2.0.0" }
splitter = { version = ">= 1.0.0 and < 2.0.0" }
Loading