{"id":21096364,"url":"https://github.com/githubtraining/markdown-finder","last_synced_at":"2025-05-16T15:34:27.427Z","repository":{"id":68761523,"uuid":"120970697","full_name":"githubtraining/markdown-finder","owner":"githubtraining","description":"🔍📖 Find things in strings of markdown.","archived":true,"fork":false,"pushed_at":"2018-02-12T01:41:43.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T07:21:19.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/githubtraining.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-02-10T00:36:38.000Z","updated_at":"2024-01-22T16:27:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"99cd1180-b9a7-4ffc-9f35-519856a38189","html_url":"https://github.com/githubtraining/markdown-finder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubtraining%2Fmarkdown-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubtraining%2Fmarkdown-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubtraining%2Fmarkdown-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubtraining%2Fmarkdown-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/githubtraining","download_url":"https://codeload.github.com/githubtraining/markdown-finder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254556965,"owners_count":22091026,"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":[],"created_at":"2024-11-19T22:35:42.917Z","updated_at":"2025-05-16T15:34:27.419Z","avatar_url":"https://github.com/githubtraining.png","language":"JavaScript","readme":"# [WIP] markdown-finder\n\nThis library can be used to validate markdown against custom functions.\n\n### Very basic example\n\n```js\nconst finder = require('markdown-finder')\n\n// Does the markdown string have at least one link?\nconst links = finder(myMarkdown).links()\nif (links.length \u003e 0) {\n  console.log('I found a link!')\n}\n\n// Is there a link to GitHub?\nconst links = finder(myMarkdown).links(links =\u003e links.filter(link =\u003e link.url === 'https://github.com'))\nif (links.length \u003e 0) {\n  console.log('I found a link to GitHub!')\n}\n```\n\nIn this basic example, if you needed to actually get the link itself, you could do:\n\n```js\nconst finder = require('markdown-finder')\n\nconst links = finder(myMarkdown).links()\n// links: [{ match, text, url }]\nconsole.log(`I found a link! It goes to ${links[0].url}!`)\n```\n\n## API\n\n| Method | Description | Get returns |\n| ------ | ----------- | ------- |\n| `images` | Returns an array of images | `[{ match, text, url }]` |\n| `links` | Returns an array of links | `[{ match, text, url }]` |\n| `bolds` | Returns an array of bolded text | `[{ match, text }]` |\n| `italics` | Returns an array of italic text | `[{ match, text }]` |\n| `code` | Returns an array of code text | `[{ match, text }]` |\n| `codeBlock` | Returns an array of code blocks | `[{ match, text, language }]` |\n\n### Using callback validators\n\nEach method takes a callback argument. This is where you can run your own validation against whatever was matched. The callback will get an array of objects argument for the matches; the shape of those objects depends on the type of thing being matched. For example, a `link` will look like:\n\n```js\nconst markdown = 'Check out [my website](https://my-website.com)!'\nconst links = finder(markdown).links()\n// links: [{ match: '[my website](https://my-website.com)', text: 'my website', url: 'https://my-website.com' }]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubtraining%2Fmarkdown-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithubtraining%2Fmarkdown-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubtraining%2Fmarkdown-finder/lists"}