{"id":21863080,"url":"https://github.com/shfshanyue/markdown-read","last_synced_at":"2025-04-30T19:09:02.753Z","repository":{"id":53608293,"uuid":"333105030","full_name":"shfshanyue/markdown-read","owner":"shfshanyue","description":"Read markdown from URL","archived":false,"fork":false,"pushed_at":"2025-04-02T01:36:06.000Z","size":340,"stargazers_count":56,"open_issues_count":3,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T19:08:44.235Z","etag":null,"topics":["markdown"],"latest_commit_sha":null,"homepage":"https://devtool.tech","language":"TypeScript","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/shfshanyue.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":"2021-01-26T14:10:21.000Z","updated_at":"2025-04-07T14:38:48.000Z","dependencies_parsed_at":"2024-09-15T12:46:02.205Z","dependency_job_id":"ca978e76-0a7c-4c55-827a-7d1a41061e75","html_url":"https://github.com/shfshanyue/markdown-read","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fmarkdown-read","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fmarkdown-read/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fmarkdown-read/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fmarkdown-read/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shfshanyue","download_url":"https://codeload.github.com/shfshanyue/markdown-read/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251767187,"owners_count":21640469,"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":["markdown"],"created_at":"2024-11-28T03:19:49.743Z","updated_at":"2025-04-30T19:09:02.704Z","avatar_url":"https://github.com/shfshanyue.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown Read\n\n[![npm version](https://img.shields.io/npm/v/markdown-read.svg)](https://www.npmjs.com/package/markdown-read)\n[![GitHub issues](https://img.shields.io/github/issues/shfshanyue/markdown-read.svg)](https://github.com/shfshanyue/markdown-read/issues)\n[![GitHub stars](https://img.shields.io/github/stars/shfshanyue/markdown-read.svg)](https://github.com/shfshanyue/markdown-read/stargazers)\n[![npm downloads](https://img.shields.io/npm/dm/markdown-read.svg)](https://www.npmjs.com/package/markdown-read)\n[![TypeScript](https://img.shields.io/npm/types/markdown-read.svg)](https://www.npmjs.com/package/markdown-read)\n[![node version](https://img.shields.io/node/v/markdown-read.svg)](https://www.npmjs.com/package/markdown-read)\n[![code size](https://img.shields.io/github/languages/code-size/shfshanyue/markdown-read.svg)](https://github.com/shfshanyue/markdown-read)\n[![install size](https://packagephobia.now.sh/badge?p=markdown-read)](https://packagephobia.now.sh/result?p=markdown-read)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/markdown-read.svg)](https://bundlephobia.com/result?p=markdown-read)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/markdown-read.svg)](https://bundlephobia.com/result?p=markdown-read)\n[![dependencies](https://img.shields.io/badge/dependencies-2-brightgreen.svg)](https://github.com/shfshanyue/markdown-read/blob/master/package.json)\n[![tree shaking](https://badgen.net/bundlephobia/tree-shaking/markdown-read)](https://bundlephobia.com/result?p=markdown-read)\n\nConvert any URL to Markdown.\n\n[Try it online: HTML To Markdown](https://devtool.tech/html-md)\n\n## Tech Stack\n\n+ `@mozilla/readability` for read meaning html\n+ `turndown` for html to markdown\n+ `jsdom` for parse html\n\n## Usage\n\nYou will need Node.js installed on your system, then install it globally.\n\n``` bash\n$ npm i -g markdown-read\n\n# Turn current page to markdown\n$ markdown https://example.com\n## Example Domain\n\nThis domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.\n\n[More information...](https://www.iana.org/domains/example)\n```\n\n### Options\n\n- `--header`: Add custom headers to the request. This can be useful for setting user-agent strings or other HTTP headers required by the target website.\n\nExample:\n\n``` bash\n$ markdown https://httpbin.org/get --header 'User-Agent: Markdown Reader'\n```\n\n## API Reference\n\n### `markdown(url: string, options?: MarkdownOptions): Promise\u003cMarkdownContent | null\u003e`\n\nConverts a web page to Markdown format.\n\n- `url`: The URL of the web page to convert\n- `options`: Optional settings for document retrieval and Markdown conversion\n  - `headers`: Additional headers to include in the request\n  - `fetcher`: Custom function to fetch the HTML content\n  - All options from `TurndownOptions` are also supported\n\nReturns a Promise that resolves to a `MarkdownContent` object or `null` if conversion fails.\n\n#### MarkdownContent\n\nThe `MarkdownContent` object extends `ReadabilityContent` and includes:\n\n- `markdown`: The converted Markdown content\n- `length`: The length of the Markdown content\n- `url`: The original URL of the web page\n\n### `turndown(html: string, options?: TurndownOptions): string`\n\nConverts HTML content to Markdown.\n\n- `html`: The HTML string to convert\n- `options`: Optional settings for Turndown conversion. These options will override the default settings.\n\nReturns the Markdown representation of the input HTML.\n\n#### Default Options\n\n```javascript\n{\n  emDelimiter: '*',\n  codeBlockStyle: 'fenced',\n  fence: '```',\n  headingStyle: 'atx',\n  bulletListMarker: '+'\n}\n```\n\n#### Example\n\n```javascript\nimport { turndown } from 'markdown-read';\n\nconst html = '\u003ch1\u003eHello\u003c/h1\u003e\u003cem\u003eWorld\u003c/em\u003e';\nconst options = {\n  headingStyle: 'setext',\n  emDelimiter: '_'\n};\n\nconst markdown = turndown(html, options);\nconsole.log(markdown);\n// Output:\n// Hello\n// =====\n//\n// _World_\n```\n\nFor a full list of available options, please refer to the [Turndown Options documentation](https://github.com/mixmark-io/turndown#options).\n\n## Advanced Features\n\n- Handles lazy-loaded images by setting their `src` attribute.\n- Extracts byline information from meta tags.\n- Supports platform-specific processing for various websites.\n- Uses Mozilla's Readability for content extraction.\n- Allows custom fetching logic through the `fetcher` option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshfshanyue%2Fmarkdown-read","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshfshanyue%2Fmarkdown-read","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshfshanyue%2Fmarkdown-read/lists"}