{"id":21525270,"url":"https://github.com/superraytin/github-style-page","last_synced_at":"2026-02-01T01:03:38.965Z","repository":{"id":57271069,"uuid":"48686035","full_name":"superRaytin/github-style-page","owner":"superRaytin","description":"Converting markdown content into HTML file with Github styles (GFW).","archived":false,"fork":false,"pushed_at":"2015-12-30T02:49:08.000Z","size":149,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T05:25:11.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/superRaytin.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":"2015-12-28T09:55:26.000Z","updated_at":"2016-08-16T04:40:01.000Z","dependencies_parsed_at":"2022-09-06T21:50:42.174Z","dependency_job_id":null,"html_url":"https://github.com/superRaytin/github-style-page","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superRaytin%2Fgithub-style-page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superRaytin%2Fgithub-style-page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superRaytin%2Fgithub-style-page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superRaytin%2Fgithub-style-page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superRaytin","download_url":"https://codeload.github.com/superRaytin/github-style-page/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085008,"owners_count":20395523,"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-24T01:34:10.082Z","updated_at":"2026-02-01T01:03:38.917Z","avatar_url":"https://github.com/superRaytin.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-style-page\n\u003e Converting markdown content into HTML file with Github styles (GFW).\n\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![Build Status](https://travis-ci.org/superRaytin/github-style-page.svg?branch=master)](https://travis-ci.org/superRaytin/github-style-page)\n\n[![github-style-page](https://nodei.co/npm/github-style-page.png)](https://npmjs.org/package/github-style-page)\n\n[npm-url]: https://npmjs.org/package/github-style-page\n[downloads-image]: http://img.shields.io/npm/dm/github-style-page.svg\n[npm-image]: http://img.shields.io/npm/v/github-style-page.svg\n\n# Installation\n\n```\nnpm install github-style-page\n```\n\n# Quick Start\n\n```js\nvar githubStylePage = require('github-style-page');\n\ngithubStylePage('path/to/example.md', 'path/to/', function() {\n    console.log('path/to/example.html generated!');\n});\n\ngithubStylePage('## Options', 'path/to/', {\n    isContent: true\n}, function() {\n    console.log('path/to/index.html generated!');\n});\n```\n\n# API\n\n```js\nvar githubStylePage = require('github-style-page');\n```\n\n### githubStylePage(path, targetDir [, options], callback)\n\n- **path:** the path where the markdown file.\n- **targetDir:** the directory path where the converted file will be saved.\n- **options:** deal with some optional parameters, see [options](#options) for detail.\n- **callback:** a function to be executed when converting is complete.\n\n\u003e Note: if `targetDir` set to null, the converted content will not be saved as a file, but will be passed to the callback.\n\nBelow is an example:\n\n```js\ngithubStylePage('path/to/example.md', 'path/to/', function() {\n    console.log('path/to/example.html generated!');\n});\n\ngithubStylePage('path/to/example.md', null, function(html) {\n    console.log('converted html content:', html);\n});\n```\n\n### githubStylePage(markdownString, targetDir [, options], callback)\n\nProvide a markdown string exactly.\n\n\u003e Note: set `isContent` to true to tell `github-style-page` current is a markdown string.\n\nBelow is an example:\n\n```js\ngithubStylePage('## Options', 'path/to/', {\n    isContent: true\n}, function() {\n    console.log('path/to/index.html generated!');\n});\n```\n\n## Options\n\n### vars\n\nTemplate variables. Make sure that all variables used in the template where the `customizeTemplatePath` have been passed by the `vars`.\n\n### isContent\n\nIndicate that currently is a markdown string.\n\n```js\ngithubStylePage('## Options', 'path/to/', {\n    isContent: true\n}, function() {\n    console.log('path/to/index.html generated!');\n});\n```\n\n### template\n\nA string to indicate the template will be used to render the markdown content.\n\nCurrently built-in templates:\n\n- **simple** the default template theme.\n- **project** NPM project style.\n\n[View all the template files](https://github.com/superRaytin/github-style-page/tree/master/lib/template).\n\n#### `simple`\n\nScreen shot:\n\n\u003cp style=\"text-align: center\"\u003e\n    \u003cimg src=\"test/screenshot-simple.png\" width=\"850\"\u003e\n\u003c/p\u003e\n\n#### `project`\n\nBelow is an `project` example, note that `pkg` should be provided and at least contains `name` and `version`:\n\n```js\ngithubStylePage('path/to/example.md', 'path/to/', {\n    template: 'project',\n    vars: {\n        pkg: {\n            name: 'github-style-page',\n            version: '0.1.1'\n        },\n        examples: ['simple', 'complex']\n    }\n}, function() {\n    console.log('path/to/example.html generated!');\n});\n```\n\nScreen shot:\n\n\u003cp style=\"text-align: center\"\u003e\n    \u003cimg src=\"test/screenshot-project.png\" width=\"850\"\u003e\n\u003c/p\u003e\n\nIf the above templates does not meet your needs, you can customize one and add it in this list. Then create a [Pull Request](https://github.com/superRaytin/github-style-page/pulls) without hesitate.\n\n### customizeTemplatePath\n\nProvide a customize template path to render the parsed markdown content.\n\n\u003e Note: if provided, the `template` option will take no effect.\n\n```js\ngithubStylePage('path/to/example.md', 'path/to/', {\n    customizeTemplatePath: 'path/to/customTemplate.html',\n    vars: {\n        a: 'xxx',\n        b: 'xxx'\n    }\n}, function() {\n    console.log('path/to/example.html generated!');\n});\n```\n\n### markedOptions\n\nConfiguration for markdown parser, see [marked#options](https://github.com/chjj/marked#options-1) for detail.\n\nDefault value:\n\n```js\n{\n    gfm: true,\n    tables: true,\n    breaks: false\n}\n```\n\nBelow is an example:\n\n```js\ngithubStylePage('## Options', 'path/to/', {\n    markedOptions: {\n        tables: true,\n        breaks: false\n    }\n}, function() {\n    console.log('path/to/index.html generated!');\n});\n```\n\n### fileName\n\nSpecify the name of the converted file will be saved.\n\n```js\ngithubStylePage('path/to/example.md', 'path/to/', {\n    fileName: 'readme'\n}, function() {\n    console.log('path/to/readme.html generated!');\n});\n```\n\n# Testing\n\n```\nnpm test\n```\n\n# License\n\nMIT, see the [LICENSE](/LICENSE) file for detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperraytin%2Fgithub-style-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperraytin%2Fgithub-style-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperraytin%2Fgithub-style-page/lists"}