{"id":21004706,"url":"https://github.com/flaque/mark-dom","last_synced_at":"2025-05-15T01:33:07.147Z","repository":{"id":80716029,"uuid":"97903035","full_name":"Flaque/mark-dom","owner":"Flaque","description":"A query API for markdown","archived":false,"fork":false,"pushed_at":"2017-07-29T23:31:05.000Z","size":753,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T01:41:28.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Flaque.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":"2017-07-21T03:40:15.000Z","updated_at":"2018-01-07T00:52:07.000Z","dependencies_parsed_at":"2023-02-28T10:15:36.781Z","dependency_job_id":null,"html_url":"https://github.com/Flaque/mark-dom","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/Flaque%2Fmark-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fmark-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fmark-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2Fmark-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flaque","download_url":"https://codeload.github.com/Flaque/mark-dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254256477,"owners_count":22040298,"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-19T08:37:33.498Z","updated_at":"2025-05-15T01:33:07.136Z","avatar_url":"https://github.com/Flaque.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mark-dom\n\n[![Build Status](https://travis-ci.org/Flaque/mark-dom.svg?branch=master)](https://travis-ci.org/Flaque/mark-dom)\n[![Coverage Status](https://coveralls.io/repos/github/Flaque/mark-dom/badge.svg?branch=master)](https://coveralls.io/github/Flaque/mark-dom?branch=master)\n\nMark-dom is basically jQuery but for markdown. \n\nIf you've ever wanted to write a script that only edits a single part of a markdown doc and leaves the rest alone, then hopefully this brings you joy.\n\n[Docs Here.](https://flaque.github.io/mark-dom/MarkdownNode.html)\n\n## Install\n\n```\n$ npm install mark-dom\n```\n\n## Example \n\n### Our Example Markdown\n``` markdown\n\u003c!-- This is some markdown --\u003e\n# Hello there\nI am some markdown\n\n## Dogs are cool\nThey bring you friendly joy.\n\n## World peace is cool\nLet's bake some cakes and be nice to each other\n```\n\n### Get a header value\n``` js\nimport mrk = require(\"mark-dom\");\n\n// Returns \"World peace is cool\"\nmrk(thatMarkdownStr)\n    .heading(\"## World peace *\")\n    .value();\n```\n\n### Change a header\n``` js\nimport mrk = require(\"mark-dom\");\n\n// Return a new markdown string where the first header \n// is \"Stuff that's cool\"\nmrk(thatMarkdownStr)\n    .heading() // gets the first heading!\n    .set(\"Stuff that's cool\");\n    .getAll();\n```\n\n### Change an entire paragraph\n``` js \nimport mrk = require(\"mark-dom\");\n\n// Change the \"dogs\" header and return a new markdown string\nmrk(thatMarkdownStr)\n    .heading(\"## * \") // Get the first sub header\n    .paragraph()\n    .set(\"They make you smile.\")\n    .getAll();\n```\n\n## Status\nMark-dom is really just an experiment at the moment and I haven't really fleshed out all of the API that I want yet. Things might change, at the time that I'm writing this, I don't think it even works.\n\n### TODO list\n* ~Glob syntax `*`~\n* Find tables\n* Find code \n* Find lists\n* Putting a 2d array in `set()` will create a table\n* Putting a 1d array in `set()` will create a list\n\n## How's it work? \nMark-dom uses [remark](https://github.com/wooorm/remark/tree/master/packages/remark) and it's ecosystem to parse the markdown into an Abstract Syntax Tree (AST), then it lets you navigate and edit the tree with an API and eventually construct a new markdown document by compiling the tree down to a string.\n\n## What's the use case?\n* Auto-generating README's\n* Forcing standards/style-guides to docs\n* ???\n* Profit!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fmark-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaque%2Fmark-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fmark-dom/lists"}