{"id":13714981,"url":"https://github.com/angrykoala/yamp","last_synced_at":"2025-05-07T03:31:06.448Z","repository":{"id":57403041,"uuid":"67144930","full_name":"angrykoala/yamp","owner":"angrykoala","description":"Yet Another Markdown Parser","archived":true,"fork":false,"pushed_at":"2020-01-23T23:48:52.000Z","size":1379,"stargazers_count":28,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-20T12:06:42.175Z","etag":null,"topics":["html","javascript","markdown","markdown-parser","marked","nodejs","pdf"],"latest_commit_sha":null,"homepage":"https://angrykoala.github.io/yamp/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angrykoala.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-01T15:45:59.000Z","updated_at":"2023-10-17T17:16:31.000Z","dependencies_parsed_at":"2022-09-13T02:31:56.321Z","dependency_job_id":null,"html_url":"https://github.com/angrykoala/yamp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrykoala%2Fyamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrykoala%2Fyamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrykoala%2Fyamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrykoala%2Fyamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angrykoala","download_url":"https://codeload.github.com/angrykoala/yamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252455695,"owners_count":21750513,"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":["html","javascript","markdown","markdown-parser","marked","nodejs","pdf"],"created_at":"2024-08-03T00:00:52.680Z","updated_at":"2025-05-07T03:31:04.860Z","avatar_url":"https://github.com/angrykoala.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["Converters"],"readme":"Yamp\n====\n_by @angrykoala_\n\n[![npm version](https://badge.fury.io/js/yamp.svg)](https://badge.fury.io/js/yamp) \n[![Build Status](https://travis-ci.org/angrykoala/yamp.svg?branch=master)](https://travis-ci.org/angrykoala/yamp) \n[![codecov](https://codecov.io/gh/angrykoala/yamp/branch/master/graph/badge.svg)](https://codecov.io/gh/angrykoala/yamp)\n[![Dependency Status](https://gemnasium.com/badges/github.com/angrykoala/yamp.svg)](https://gemnasium.com/github.com/angrykoala/yamp)       \n\n\u003eYet Another Markdown Parser\n\nThe aim of this package is to provide an easy-to-use toolbox for markdown-related task including Html \u0026 Pdf conversion.\n\n* **GitHub:** \u003chttps://github.com/angrykoala/yamp\u003e\n* **Npm:** \u003chttps://www.npmjs.com/package/yamp\u003e\n\n## Features\n* HTML conversion\n* PDF conversion\n* Code highlight support\n* Github-style and academic output\n* API to use _yamp_ programmatically\n* Custom styles\n* CSS-embedded HTML (just open it offline in any browser)\n* HTML tags support (for PDF output too)\n* Include other files in your markdown\n* [HTML presentations](https://remarkjs.com/)\n* Front Matter metadata\n* Custom [xejs-based](https://github.com/angrykoala/xejs) tags (`{{}}`)\n* Koalafied\n\n\n### Upcoming features\n\n* Custom templates\n* Client-side web support (browserify)\n\n \n\u003e Check the [project roadmap](https://github.com/angrykoala/yamp/milestones?direction=desc\u0026sort=completeness\u0026state=open) and our cute [kanban board](https://github.com/angrykoala/yamp/projects/1)\n\n## Installation\nTo use _yamp_ cli, install it globally using **npm**:\n```\nnpm install -g yamp\n```\n\nIf you want to use the API instead, install it locally:\n```\nnpm install --save yamp\n```\n\nthen, include yamp in your javascript:\n```js\nvar yamp = require('yamp');\n```\n\n\n## Usage\nTo create a `.pdf` file from your _markdown_ file, simply type:\n```\nyamp \u003cfile.md\u003e\n```\nFor example:\n```\nyamp README.md\n```\nWill generate `readme.pdf`.\n\n### Options\n* `-h`, `--help` to display a basic usage information\n* `-V`, `--version` to display _yamp_ version installed\n* `-o`, `--output \u003cfile\u003e` output filename (without extension) e.g. `yamp my_file.md -o final_name`\n* `--pdf` to generate a pdf (default)\n* `--html`to generate html\n* `--remark`to generate a html presentation using [remark](https://remarkjs.com)\n* `-t`, `--title [value]` to add a custom title to Html pages\n* `--style \u003cfile\u003e` to set change the css style (supports the provided styles and custom styles)\n    * Option not suported along with `--no-style`\n* `--no-style` to disable CSS styling\n    * Option not supported along with `--style \u003cfile\u003e`\n* `--list-styles` will list all the styles provided by yamp\n\t* These styles will be supported by `--style` option\n* `--minify` to minify Html output\n* `--no-tags` to disable custom Yamp tags\n* `--no-highlight` to disable code [highlight](https://highlightjs.org)\n* `--no-front-matter` to disable front-matter metadata\n* `-k`, `--koala` to koalify your outputs\n\nTo generate pdf and html with default styling and options:\n```\nyamp myFile.md --pdf --html\n```\n\n\u003eThe `--no-highlight` and `--no-style` options will greatly reduce your Html and Pdf outputs\n\n\n## Yamp tags\n_Yamp_ supports extra tags in your markdown files. Currently using [xejs](https://github.com/angrykoala/xejs) templates. All tags are written between double braces `{{ ... }}` and are not case-sensitive\n\n* `include [file.md]`: Includes the given text file (markdown or not), the tags on the included file will also be parsed, allowing nested file structure.\n* `date`: Will write the current date (at the moment of rendering).\n* `page break`: Will force a page break in pdf output.\n* `yamp version`: Will display the yamp version used to render the document.\n\n\u003e  Starting a tag with `{{#` will create a comment tag that will not be rendered into the final file\n\n## Yamp styles\n_Yamp_ provides several styles for your document (supported for html and pdf outputs).\n* `github.css` Default style, will look similar to **Github** style\n* `acm-sig.css` Academic style based on ACM SIG templates\n\nYou can select any of these styles with the option `--style [style.css]`, the same option will enable you to use your own files instead `--style [myfolder/mystyle.css]`\n\n\u003e You can always check the styles with the option `--list-styles`\n\n## API\nInclude _yamp_ in your javascript with:\n```js\nvar yamp = require('yamp');\n```\n\nYou'll have access to different _renderers_ to process your files:\n* `yamp.renderers.html` to process a markdown file into an full Html page\n* `yamp.renderers.pdf` to process a markdown into a pdf\n\nTo use a renderer:\n```js\nvar myRenderer = new renderers.pdf(options);\nrenderer.renderFile(myFile, function(err){\n    if (err) return console.log(\"Error while rendering: \"+err);\n    else console.log(\"Rendering was successful\");\n});\n```\n\n### Options\nThe options accepted by the default renderers are:\n\n* **outputFilename**: name of the output filename (without extension), will default to the input filename\n* **highlight**: (_true_) indicates if code blocks should be highlighted\n* **style**: (_true_) indicates if default style should be used or no style at all. If a filename is passed, it will use it as custom css style\n* **minify**: (_false_) whether the Html output should be minified or not\n* **title**: Custom title for the Html page\n* **tags**: (_true_) whether to parse yamp tags or not (`{{ ... }}`) \n* **koala**: (_false_) true to koalify your outputs\n\n### Creating new renderers\nIf you need a custom renderer, instead of using one of the defaults you can extend directly from **Renderer** class or any of the default renderers:\n\n```js\nclass MyCustomRenderer extends yamp.Renderer {\n    constructor(options) {\n        super(options, \"default.ejs\", yamp.parsers.md2Html);\n        this.output=\"html\"; //desired output extension\n    }\n\n    beforeLoad(filename){\n        //Modify filename or this.fileLoader before loading it\n    }\n\n\n    beforeRender(templateOptions) {\n        // Modify the data passed to the template before rendering, including title, content and options\n    }\n    \n    afterRender(content) {\n        // Modify template result (Html)\n    }\n\n    fileOutput(content,done) {\n        // Write file (preferably to this.options.outputFilename) in the desired format using a parser\n    }\n}\n```\n\n**Custom parser:** It is possible to use a custom parser from markdown to Html instead of the built-in _yamp.parsers.md2html_, the parser must be a function of the type `function(originalString,options,callback)` that will translate from `originalString` (markdown) to html, calling the `callback(err,res)` afterwards.\n\nIf, instead of extending from `yamp.Renderer` you are extending from one of the default renderers, you should only re-implement the methods you need, and usually you should call `super().methodName` to maintain its basic functionality.\n\n## Development Instructions\nTo contribute to **yamp** you should clone the official repository \u003chttps://github.com/angrykoala/yamp\u003e or your own _fork_ with `git`.\n\nYou can also download it from [GitHub](https://github.com) clicking [here](https://github.com/angrykoala/yamp/archive/master.zip)\n\n* To install execute `npm install` in the downloaded/cloned folder\n* To test, execute `npm test`\n    * The tests will also run _jshint_\n* To execute the CLI, execute `npm start -- \u003cfile\u003e [options]`\n* To install your local version globally, execute `npm install -g .` on the project folder\n* To generate documentation (with installed version of _yamp_) execute `npm run docs`\n\n\u003eIt is strongly recommended to install the npm repository version instead of your local copy\n\n## Contributors\nIf you want to contribute to yamp please:   \n\n1. Read [CONTRIBUTING.md](CONTRIBUTING.md)\n2. Fork from [dev branch](https://github.com/angrykoala/yamp/tree/dev)\n3. Make sure tests passes before pull request\n4. Check the opened and closed issues before creating one\n\nThanks for your help!\n\n## Acknowledgments\n* [Marked](https://github.com/chjj/marked) as markdown parser\n* [Github-markdown.css](https://github.com/sindresorhus/github-markdown-css) as default style\n* [Highlight.js](https://highlightjs.org) for code highlighting\n* [html-pdf](https://github.com/marcbachmann/node-html-pdf) for pdf generation\n* [remark](https://remarkjs.com) for html slides output\n* [pubcss](https://github.com/thomaspark/pubcss) for academic output style\n\n\u003eYAMP is developed under GNU GPL-3 license by @angrykoala \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrykoala%2Fyamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangrykoala%2Fyamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrykoala%2Fyamp/lists"}