{"id":13410023,"url":"https://github.com/cyucelen/marker","last_synced_at":"2026-01-17T14:45:48.084Z","repository":{"id":43245844,"uuid":"204967582","full_name":"cyucelen/marker","owner":"cyucelen","description":" 🖍️ Marker is the easiest way to match and mark strings for colorful terminal outputs!","archived":false,"fork":false,"pushed_at":"2023-10-03T23:50:04.000Z","size":847,"stargazers_count":51,"open_issues_count":4,"forks_count":13,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T08:24:00.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyucelen.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}},"created_at":"2019-08-28T15:44:08.000Z","updated_at":"2025-06-22T13:29:48.000Z","dependencies_parsed_at":"2024-01-08T14:30:48.288Z","dependency_job_id":"819e8cdd-ed43-4d4a-bebe-e674e18e0526","html_url":"https://github.com/cyucelen/marker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cyucelen/marker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyucelen%2Fmarker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyucelen%2Fmarker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyucelen%2Fmarker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyucelen%2Fmarker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyucelen","download_url":"https://codeload.github.com/cyucelen/marker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyucelen%2Fmarker/sbom","scorecard":{"id":314862,"data":{"date":"2025-08-11","repo":{"name":"github.com/cyucelen/marker","commit":"ec8d542c2d2872b3b34dc7b18c7814e40bc1c733"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":2,"reason":"Found 3/11 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/cyucelen/marker/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/cyucelen/marker/go.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: .github/workflows/go.yml:23","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq","Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3","Warn: Project is vulnerable to: PYSEC-2023-227 / GHSA-8ghj-p4vj-mr35","Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr","Warn: Project is vulnerable to: PYSEC-2022-42979 / GHSA-m2vv-5vj5-2hm7","Warn: Project is vulnerable to: PYSEC-2023-175"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T23:58:07.365Z","repository_id":43245844,"created_at":"2025-08-17T23:58:07.366Z","updated_at":"2025-08-17T23:58:07.366Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-30T20:01:04.555Z","updated_at":"2026-01-17T14:45:48.065Z","avatar_url":"https://github.com/cyucelen.png","language":"Go","funding_links":[],"categories":["Command Line","Build Automation","命令行"],"sub_categories":["Advanced Console UIs","高级控制台用户界面"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg height=\"200px\" src=\"assets/logo.png\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n       \u003cb\u003eMarker is the easiest way to match and mark strings for colorful terminal outputs.\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/cyucelen/marker/actions/workflows/go.yml\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/workflow/status/cyucelen/marker/Go\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/cyucelen/marker\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/cyucelen/marker/branch/master/graph/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/cyucelen/marker\"\u003e\n    \u003cimg src=\"https://goreportcard.com/badge/github.com/cyucelen/marker\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/cyucelen/marker/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/cyucelen/marker.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/kaUtncA\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/638774450862555157?color=%237289da\u0026label=discord\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# marker\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/png/showoff.png\"\u003e\n\u003c/p\u003e\n\nMarker is built for easily match and mark strings for colorful terminal outputs. You can match your strings with built-in matchers or easily implement a custom matcher for your usecase. Marker uses [fatih/color](https://github.com/fatih/color)\nfor colorizing terminal output.\n\n## Installation\n\n`go get github.com/cyucelen/marker`\n\n## Basic Usage\n\nMarker has very simple and extensible way to get your strings colorful and brilliant!\n\n### Example\n\n```go\naristotleQuote := \"The more you know, the more you realize you don't know.\"\nemphasized := marker.Mark(aristotleQuote, marker.MatchAll(\"know\"), color.New(color.FgRed))\nfmt.Println(emphasized)\n```\n\n\u003cimg src=\"assets/png/matchall.png\"\u003e\n\n## Table of Contents\n\n- [Mark Your Log Stream](#mark-your-log-stream)\n- [Custom `io.Writer` out for log interface](#custom-iowriter-out-for-log-interface)\n- [Matchers](#matchers)\n  - [MatchAll](#matchall)\n  - [MatchN](#matchn)\n  - [MatchRegexp](#matchregexp)\n  - [MatchSurrounded](#matchsurrounded)\n  - [MatchBracketSurrounded](#matchbracketsurrounded)\n  - [MatchParensSurrounded](#matchparenssurrounded)\n  - [MatchTimestamp](#matchtimestamp)\n  - [Builder way](#builder-way)\n  - [Writing your custom Matcher](#writing-your-custom-matcher)\n- [Contribution](#contribution)\n\n---\n\n## Mark Your Log Stream\n\nYou may want to instrument a logger such that any output coming from it is colorized in the expected manner. `marker` contains functionality which can be easily integrated with Golang's `log` or any interface that supports `io.Writer`.\n\n```go\nstdoutMarker := marker.NewStdoutMarker()\nmarkRules := []marker.MarkRule{\n  {marker.MatchBracketSurrounded(), color.New(color.FgBlue)},\n  {marker.MatchAll(\"marker\"), color.New(color.FgRed)},\n}\n\nstdoutMarker.AddRules(markRules)\nlogger := log.New(stdoutMarker, \"\", 0)\n\nlogger.Println(\"[INFO] marker is working as expected\")\n```\n\n\u003cimg src=\"assets/png/log.png\"\u003e\n\n### Custom `io.Writer` out for log interface\n\n`marker` also allows you to specify the `io.Writer` that you want to send output to. This is useful if the logger is writing to somewhere other than `stdout` like a file.\n\n```go\nf, _ := os.Create(\"/tmp/awesome.log\")\nw := bufio.NewWriter(f)\n\nwriteMarker := marker.NewWriteMarker(w)\n\nmarkRules := []marker.MarkRule{\n  {marker.MatchBracketSurrounded(), blueFg},\n  {marker.MatchAll(\"marker\"), magentaFg},\n}\n\nwriteMarker.AddRules(markRules)\n\nlogger := log.New(writeMarker, \"\", 0)\nlogger.Println(\"[INFO] colorful logs even in files, marker to mark them all!\")\n\nw.Flush()\nf.Close()\n\noutput := catFile(\"/tmp/awesome.log\") // $ cat /tmp/awesome.log\nfmt.Print(output)\n```\n\n\u003cimg src=\"assets/png/logtofile.png\"\u003e\n\n---\n\n## Matchers\n\n#### MatchAll\n\n```go\naristotleQuote := \"The more you know, the more you realize you don't know.\"\nemphasized := marker.Mark(aristotleQuote, marker.MatchAll(\"know\"), color.New(color.FgRed))\nfmt.Println(emphasized)\n```\n\n\u003cimg src=\"assets/png/matchall.png\"\u003e\n\n#### MatchN\n\n```go\nboringLog := \"[INFO] Nobody wants to read pale [INFO] tags.\"\nbrilliantLog := marker.Mark(boringLog, marker.MatchN(\"[INFO]\", 1), color.New(color.FgBlue))\nfmt.Println(brilliantLog)\n```\n\n\u003cimg src=\"assets/png/matchn.png\"\u003e\n\n#### MatchRegexp\n\n```go\nrhyme := \"I scream, you all scream, we all scream for ice cream.\"\nr, _ := regexp.Compile(\"([a-z]?cream)\")\ncareAboutCream := marker.Mark(rhyme, marker.MatchRegexp(r), color.New(color.FgYellow))\nfmt.Println(careAboutCream)\n```\n\n\u003cimg src=\"assets/png/matchregex.png\"\u003e\n\n#### MatchSurrounded\n\n```go\nsentence := \"I pull out things surrounded by abcWHOA COLORSdef\"\nmarkedSurrounded := marker.Mark(sentence, marker.MatchSurrounded(\"abc\", \"def\"), color.New(color.FgMagenta))\nfmt.Println(markedSurrounded)\n```\n\n\u003cimg src=\"assets/png/matchsurrounded1.png\"\u003e\n\n#### MatchBracketSurrounded\n\n```go\nsentence = \"[INFO] This is what log lines look like\"\nmarkedSurrounded = marker.Mark(sentence, marker.MatchBracketSurrounded(), color.New(color.FgRed))\nfmt.Println(markedSurrounded)\n```\n\n\u003cimg src=\"assets/png/matchsurrounded2.png\"\u003e\n\n#### MatchParensSurrounded\n\n```go\nsentence = \"[ERROR] This is what (parens) lines look like\"\nmarkedSurrounded = marker.Mark(sentence, marker.MatchParensSurrounded(), color.New(color.FgBlue))\nfmt.Println(markedSurrounded)\n```\n\n\u003cimg src=\"assets/png/matchsurrounded3.png\"\u003e\n\n#### MatchTimestamp\n\n`MatchTimestamp` can be used for matching the timestamps fits the layouts in Golang's `time`.\n\nAll possible formats can be found [here](https://github.com/golang/go/blob/8de0bb77ebc3408a586ad96a3c9ae9c231fd15a3/src/time/format.go#L73).\n\n```go\n  goodOldTimes := \"2006-01-02T15:04:05Z07:00 [INFO] Loading King of Fighters '97 ROM\"\n  timestampMarked := marker.Mark(goodOldTimes, marker.MatchTimestamp(time.RFC3339), color.New(color.FgBlue))\n  fmt.Println(timestampMarked)\n```\n\n\u003cimg src=\"assets/png/matchtimestamp.png\"\u003e\n\n---\n\n## Builder way\n\nIf you want to mark different patterns in the same string, marker builder is neater way to do this.\n\n```go\nrhyme := \"I scream, you all scream, we all scream for ice cream.\"\nb := \u0026marker.MarkBuilder{}\nr, _ := regexp.Compile(\"([a-z]?cream)\")\n\nmarkedWithBuilder := b.SetString(rhyme).\n  Mark(marker.MatchN(\"for ice\", 1), color.New(color.FgRed)).\n  Mark(marker.MatchAll(\"all\"), color.New(color.FgMagenta)).\n  Mark(marker.MatchRegexp(r), color.New(color.FgYellow)).\n  Build()\n\nfmt.Println(markedWithBuilder)\n```\n\n\u003cimg src=\"assets/png/builder.png\"\u003e\n\n---\n\n## Writing your custom `Matcher`\n\nAs you see in above examples, **Mark** function takes an **MatcherFunc** to match the patterns in given string and colorize them.\nA **Matcher** is a simple closure that returns a **MatcherFunc** to be called by **Mark** function to get **Match** information to put colorized versions of patterns into template.\n\nLets write our own custom Matcher that matches first encounter of given pattern.\n\n### Example\n\n```go\n\n  func MatchFirst(pattern string) marker.MatcherFunc {\n    return func(str string) marker.Match {\n      return marker.Match{\n        // replace first matching pattern with %s\n        Template: strings.Replace(str, pattern, \"%s\", 1),\n        // patterns to be colorized by Mark, in order\n        Patterns: []string{pattern},\n      }\n    }\n  }\n```\n\nYou can also check built-in [matchers](https://github.com/cyucelen/marker/blob/master/matcher.go) for inspiration.\n\n# Contribution\n\nI would like to accept any contributions to make Marker better and feature rich. So feel free to contribute your features(i.e. more **Matcher**s!), improvements and fixes.\n\n## Have fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyucelen%2Fmarker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyucelen%2Fmarker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyucelen%2Fmarker/lists"}