{"id":16189317,"url":"https://github.com/caolan/wmd","last_synced_at":"2025-03-19T03:30:51.456Z","repository":{"id":1098769,"uuid":"959025","full_name":"caolan/wmd","owner":"caolan","description":"wanton markdown - a markdown parser based on showdown","archived":false,"fork":false,"pushed_at":"2012-07-08T06:32:33.000Z","size":191,"stargazers_count":15,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T15:05:07.175Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caolan.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}},"created_at":"2010-10-03T20:38:32.000Z","updated_at":"2024-07-04T04:56:15.000Z","dependencies_parsed_at":"2022-07-06T08:01:10.976Z","dependency_job_id":null,"html_url":"https://github.com/caolan/wmd","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fwmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fwmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fwmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fwmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/wmd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965774,"owners_count":20375917,"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-10-10T07:35:01.807Z","updated_at":"2025-03-19T03:30:51.182Z","avatar_url":"https://github.com/caolan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WMD\n\nA Markdown parser for CommonJS (and node.js) based on the excellent\n[Showdown](http://attacklab.net/showdown/).\n\nEssentially WMD, is just a wrapper around Showdown, with a few hooks for\npreprocessing, and some default preprocessors and postprocessors.\n\n\n## Example\n\n    var wmd = require('wmd');\n\n    var html = wmd('Markdown *rocks*.');\n    console.log(html);\n\n\n# Documentation\n\n\n## wmd(markdown, options)\n\n* __markdown__ - A string containing Markdown.\n* __options__ - (optional) An object containing options (see options section)\n\nThe main function for converting Markdown to HTML, and normally the only\nfunction you'll need ot use. Applies all preprocessors defined in options\nbefore passing the result to Showdown for the final rendering.\n\nBy default, the underscores and metadata preprocessors are used.\n\nThis function returns a __doc__ object. The contents of the doc object may\ndiffer depending on the preprocessors used, but will always contain the\nfollowing:\n\n* __doc.html__ - The final HTML output of the conversion.\n* __doc.markdown__ - The markdown text passed to the processsor after all\n  preprocesor functions have been applied.\n* __doc.raw__ - The raw string before preprocessors were applied.\n\nThe string representation of a doc object (doc.toString()) is the same as\ndoc.html.\n\n\n## wmd.preprocessors\n\nAn object containing core preprocessor functions:\n\n* __underscores__ - code-friendly underscore processing taken from GitHub\n  Flavored Markdown. This means the bar in foo\\_bar\\_baz does not get emphasis.\n* __fencedCodeBlocks__ - GitHub style fenced code blocks\n* __yamlFrontMatter__ - Jekyll style YAML front matter for metadata\n* __metadata__ - takes metatdata information from the top of a markdown file\n  and adds it to doc.metadata.\n\n      property1: some value\n      property2: multi\n                 line\n                 value\n\n      # Markdown goes here\n\n  Would result in the following doc object:\n\n      {\n          metadata: {\n              property1: \"some value\",\n              property2: \"multi\\nline\\nvalue\"\n          },\n          html: \"\u003ch1\u003eMarkdown goes here\u003c/h1\u003e\",\n          markdown: \"# Markdown goes here\",\n          raw: \"property1: some value\\nproperty2: multi\\nline\\nvalue\\n\\n# Markdown goes here\"\n      }\n\nAdding preprocessors to wmd:\n\n    var wmd = require('wmd');\n    var html = wmd('Markdown *rocks*.', {\n        preprocessors: [\n            function (doc) {\n                doc.markdown += '.. even more!';\n                return doc;\n            }\n        ]\n    });\n\nBy default, the underscores and metadata preprocessors will be used.\n\n## wmd.postprocessors\n\nAn object containing core postprocessor functions:\n\n* __jsdom__ - uses jsdom to add doc.window containing the HTML generated from\n  markdown\n* __first_para__ - adds doc.first_para containing the text in the first p tag\n* __heading__ - adds doc.heading containing the text in the first h1 tag\n\nAdding postprocessors to wmd:\n\n    var wmd = require('wmd');\n    var html = wmd('Markdown *rocks*.', {\n        postprocessors: [\n            function (doc) {\n                doc.html += '\u003cb\u003emore html stuff\u003c/b\u003e';\n                return doc;\n            }\n        ]\n    });\n\nBy default, no postprocessors will be used.\n\n\n## wmd.processor(markdown)\n\n* __markdown__ - A string containing Markdown.\n\nThe function which performs the conversion from markdown to html. By default\nthis is just Showdown's makeHTML function.\n\n\n## wmd.preprocess(doc, options)\n\n* __doc__ - A doc object\n* __options__ - (optional) An object containing options (see options section)\n\nApplies the preprocessor functions defined in options to the doc (usually\nupdating doc.markdown, sometimes adding new properties) before the doc is\npassed to the processor.\n\n\n## wmd.postprocess(doc, options)\n\n* __doc__ - A doc object\n* __options__ - (optional) An object containing options (see options section)\n\nApplies the postprocessor functions defined in options to the doc.\n\n\n## wmd.readOptions(options)\n\n* __options__ - (optional) An object containing options (see options section)\n\nYou would not normally need to call this directly. This function adds default\noptions to those passed to the main wmd function.\n\n\n## Options\n\n* __preprocessors__ - An array of functions which can transform the document\n  before its passed to the processor function. By default the underscores and\n  metadata preprocessors are used.\n* __postprocessors__ - An array of functions which can transform the document\n  after its been passed to the processor function. By default, no\n  postprocessors are used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fwmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fwmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fwmd/lists"}