{"id":13665031,"url":"https://github.com/tom-wolfe/brewdown","last_synced_at":"2025-05-06T04:31:50.160Z","repository":{"id":39408457,"uuid":"98861469","full_name":"tom-wolfe/brewdown","owner":"tom-wolfe","description":"A markdown parser and stylesheet specifically for D\u0026D homebrew","archived":false,"fork":false,"pushed_at":"2022-12-09T05:17:27.000Z","size":2333,"stargazers_count":66,"open_issues_count":13,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T02:13:44.893Z","etag":null,"topics":["css","dnd","dnd5e","formatting","homebrew","javascript","markdown","markdown-it","markdown-it-plugin"],"latest_commit_sha":null,"homepage":null,"language":"CSS","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/tom-wolfe.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":"2017-07-31T07:35:53.000Z","updated_at":"2024-07-22T03:23:53.000Z","dependencies_parsed_at":"2023-01-25T16:45:19.218Z","dependency_job_id":null,"html_url":"https://github.com/tom-wolfe/brewdown","commit_stats":null,"previous_names":["trwolfe13/brewdown"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-wolfe%2Fbrewdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-wolfe%2Fbrewdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-wolfe%2Fbrewdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-wolfe%2Fbrewdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tom-wolfe","download_url":"https://codeload.github.com/tom-wolfe/brewdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224027058,"owners_count":17243548,"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":["css","dnd","dnd5e","formatting","homebrew","javascript","markdown","markdown-it","markdown-it-plugin"],"created_at":"2024-08-02T05:03:15.658Z","updated_at":"2024-11-10T23:30:28.123Z","avatar_url":"https://github.com/tom-wolfe.png","language":"CSS","readme":"# brewdown [![NPM version](https://badge.fury.io/js/brewdown.svg)](http://badge.fury.io/js/brewdown)\n\n[![Build Status](https://travis-ci.org/trwolfe13/brewdown.svg?branch=master)](https://travis-ci.org/trwolfe13/brewdown) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nA flavour of markdown and stylesheet specifically for D\u0026amp;D 5th edition homebrew, implemented as a plugin for [markdown-it](https://github.com/markdown-it/markdown-it).\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n## An Important Note\n\nDue to CSS column support not being available in some browsers, the rendered HTML will likely only display correctly in Chrome.\n\n### Installing\n\n```batchfile\nnpm install brewdown --save\n```\n\n### Usage\n\n```javascript\nconst Markdown = require('markdown-it')\nconst brewdown = require('brewdown')\n\nconst md = new Markdown().use(brewdown)\nconst html = md.render('# This is a Heading')\n\nconsole.log(html)\n```\n\n## Syntax\n\nWhere possible, the existing syntax rules have been leveraged to produce homebrew content, but out of necessity, there are some additional syntax extensions, the like of which are detailed below.\n\n### Pages and Columns\n\nBy default, markdown is rendered to be best displayed on a single column webpage. For printing, and sometimes for aesthetics, however, it is preferable to display the content in two columns, as per the printed manuals. To achieve this, set the `style` option on the brewdown plugin to `two-col`. In the same way, you can also set the page size using the `pageSize` option. The default is A4. Valid page sizes include: `a2`, `a3`, `a4`, `a5`, `a6`, `b3`, `b4`, `b5`, `letter` and `legal`.\n\n```javascript\nconst Markdown = require('markdown-it')\nconst brewdown = require('brewdown')\n\nconst md = new Markdown().use(brewdown, {style: \"two-col\", pageSize: \"letter\"})\nconst html = md.render('# This is a Heading')\n\nconsole.log(html)\n```\n\n#### New Column\n\nIt is possible to force a new column using the `\\newcolumn` command. This is often necessary as CSS columns aren't always accurate.\n\n#### New Page\n\nUnfortunately, there is no way to configure pages to flow automatically, so to begin a new page, you must use the `\\newpage` command.\n\n```md\n# First Page\n[My amazing homebrew]\n\n\\newpage\n\n# Second Page\n[More amazing homebrew]\n```\n\n### Cover Pages\n\nCover pages are horizontally centered (across both columns in two-column mode) and positioned just above vertical centre.\n\n#### Cover Markdown\n\n```md\n::: cover\n# Places\n##### Cities and Towns\n:::\n```\n\n#### Cover HTML\n\n```html\n\u003cdiv class=\"cover\"\u003e\n  \u003ch1\u003ePlaces\u003c/h1\u003e\n  \u003ch5\u003eCities and Towns\u003c/h5\u003e\n\u003c/div\u003e\n```\n\n#### Cover Preview\n\n![Cover Preview](/docs/images/coverpage.png)\n\n### Headings\n\nHeading styles range from levels 1 to 6, (`#` to `######`) and closely approximate those in the D\u0026D 5th Edition Player Handbook.\n\n### Lists\n\nList styles are the same as regular markdown, with the exception that `*` will produce a bullet point, whilst `-` will not. This is of particular use listing features/attacks in stat blocks.\n\n### Readaloud/Descriptive Text\n\nAs per the published adventures, you can produce descriptive or 'read aloud' text that is scripted. This can be done in two ways, either using the standard quoting syntax, or using the new triple quote (\"\"\") container with a description type.\n\n#### Description Markdown\n\n```md\n\"\"\"description\n# Description\nYou enter, through a low arch of cold stone, into the vast cavern beyond...\n\"\"\"\n\n\u003e # Description\n\u003e You enter, through a low arch of cold stone, into the vast cavern beyond...\n```\n\n#### Description HTML\n\n```html\n\u003cblockquote\u003e\n  \u003ch1\u003eDescription\u003c/h1\u003e\n  \u003cp\u003eYou enter, through a low arch of cold stone, into the vast cavern beyond...\u003c/p\u003e\n\u003c/blockquote\u003e\n```\n\n#### Description Preview\n\n![Description Preview](/docs/images/description.png)\n\n### Notes\n\nAs per the published adventures, you can produce descriptive or 'read aloud' text that is scripted. This can be done in two ways, either using the standard quoting syntax, or using the new triple quote (\"\"\") container with a description type.\n\n#### Note Markdown\n\n```md\n\"\"\"note\n# Markdown!\nThis text will appear inside a green box with fancy corners\n\"\"\"\n```\n\n#### Note Preview\n\n![Note Preview](/docs/images/note.png)\n\n### Ability Blocks\n\nThese are fairly straightforward, but require some new syntax that is hopefully intuitive. See the example below for an idea on how to output ability blocks.\n\n#### Ability Block Markdown\n\n```md\n{abilities: STR=7, DEX=15, CON=9, INT=8, WIS=7, CHA=8}\n```\n\n#### Ability Block HTML\n\n```html\n\u003ctable class=\"abilities\"\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eSTR\u003c/th\u003e\n      \u003cth\u003eDEX\u003c/th\u003e\n      \u003cth\u003eCON\u003c/th\u003e\n      \u003cth\u003eWIS\u003c/th\u003e\n      \u003cth\u003eINT\u003c/th\u003e\n      \u003cth\u003eCHA\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e15 (+2)\u003c/td\u003e\n      \u003ctd\u003e13 (+1)\u003c/td\u003e\n      \u003ctd\u003e1 (-5)\u003c/td\u003e\n      \u003ctd\u003e1 (-5)\u003c/td\u003e\n      \u003ctd\u003e13 (+1)\u003c/td\u003e\n      \u003ctd\u003e9 (-1)\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\n#### Ability Block Preview\n\n![Note Preview](/docs/images/abilityblock.png)\n\n### Small Tables\n\nTables are unchanged from regular markdown, they just have styles applied.\n\n### Class Tables\n\nClass tables are simple, simply wrap your class details in a `:::` block titled `classtable`, as per the example below.\n\n#### Class Table Markdown\n\n```md\n::: classtable\n##### The Programmer\n| Level | Proficiency Bonus | Features            |\n|:-----:|:-----------------:|:--------------------|\n|  1st  |         +2        | Hello World         |\n|  2nd  |         +2        | Nocturnal Biorhythm |\n|  3rd  |         +2        | Caffeine Resistance |\n:::\n```\n\n#### Class Table HTML\n\n```html\n\u003cdiv class=\"classtable\"\u003e\n  \u003ch5\u003eThe Programmer\u003c/h5\u003e\n  \u003ctable\u003e\n    \u003cthead\u003e\n      \u003ctr\u003e\n        \u003cth style=\"text-align:center\"\u003eLevel\u003c/th\u003e\n        \u003cth style=\"text-align:center\"\u003eProficiency Bonus\u003c/th\u003e\n        \u003cth style=\"text-align:left\"\u003eFeatures\u003c/th\u003e\n      \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n      \u003ctr\u003e\n        \u003ctd style=\"text-align:center\"\u003e1st\u003c/td\u003e\n        \u003ctd style=\"text-align:center\"\u003e+2\u003c/td\u003e\n        \u003ctd style=\"text-align:left\"\u003eHello World\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n        \u003ctd style=\"text-align:center\"\u003e2nd\u003c/td\u003e\n        \u003ctd style=\"text-align:center\"\u003e+2\u003c/td\u003e\n        \u003ctd style=\"text-align:left\"\u003eNocturnal Biorhythm\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr\u003e\n        \u003ctd style=\"text-align:center\"\u003e3rd\u003c/td\u003e\n        \u003ctd style=\"text-align:center\"\u003e+2\u003c/td\u003e\n        \u003ctd style=\"text-align:left\"\u003eCaffeine Resistance\u003c/td\u003e\n      \u003c/tr\u003e\n    \u003c/tbody\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n```\n\n#### Class Table Preview\n\n![Description Preview](/docs/images/classtable.png)\n\n### Stat Blocks\n\nOne of the more complex components that can be rendered is the monster stat block. An example for the correct formatting for these is listed below. Two-column stat blocks can be used with the `:::stats-wide` notation, but due to the limitations of CSS, these can break column wrapping on nearby elements.\n\n#### Stat Block Markdown\n\n```md\n:::stats\n## Kobold\n*Small Humanoid (kobold), lawful evil*\n___\n- **Armor Class** 12\n- **Hit Points** 5 (2d6 - 2)\n- **Speed** 30 ft.\n___\n{abilities: STR=7, DEX=15, CON=9, INT=8, WIS=7, CHA=8}\n___\n- **Senses** darkvision 60 ft., passivePerception 8\n- **Languages** Common, Draconic\n- **Challenge** 1/8 (25 XP)\n___\n- **Sunlight Sensitivity.** While in sunlight, the kobold has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.\n- **Pack Tactics.** The kobold has advantage on an attack roll against a creature if at least one of the kobold's allies is within 5 feet of the creature and the ally isn't incapacitated.\n___\n### Actions\n- ***Dagger.*** *Melee Weapon Attack:* +4 to hit, reach 5 ft., one target. *Hit:* 4 (1d4 + 2) piercing damage.\n- ***Sling.*** *Ranged Weapon Attack:* +4 to hit, reach 30/120 ft., one target. *Hit:* 4 (1d4 + 2) bludgeoning damage\n:::\n```\n\n#### Stat Block HTML\n\n```html\n\u003cdiv class=\"stats\"\u003e\n  \u003ch2\u003eKobold\u003c/h2\u003e\n  \u003cp\u003e\u003cem\u003eSmall Humanoid (kobold), lawful evil\u003c/em\u003e\u003c/p\u003e\n  \u003chr\u003e\n  \u003cul class=\"no-bullet\"\u003e\n    \u003cli\u003e\u003cstrong\u003eArmor Class\u003c/strong\u003e 12\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eHit Points\u003c/strong\u003e 5 (2d6 - 2)\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eSpeed\u003c/strong\u003e 30 ft.\u003c/li\u003e\n  \u003c/ul\u003e\n  \u003chr\u003e\n    \u003c!-- Omitted ability block for brevity --\u003e\n  \u003chr\u003e\n  \u003cul class=\"no-bullet\"\u003e\n    \u003cli\u003e\u003cstrong\u003eSenses\u003c/strong\u003e darkvision 60 ft., passivePerception 8\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eLanguages\u003c/strong\u003e Common, Draconic\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eChallenge\u003c/strong\u003e 1/8 (25 XP)\u003c/li\u003e\n  \u003c/ul\u003e\n  \u003chr\u003e\n  \u003cul class=\"no-bullet\"\u003e\n    \u003cli\u003e\u003cstrong\u003eSunlight Sensitivity.\u003c/strong\u003e While in sunlight, the kobold has disadvantage on attack rolls, as well as on\n      Wisdom (Perception) checks that rely on sight.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003ePack Tactics.\u003c/strong\u003e The kobold has advantage on an attack roll against a creature if at least one of the kobold's\n      allies is within 5 feet of the creature and the ally isn't incapacitated.\u003c/li\u003e\n  \u003c/ul\u003e\n  \u003chr\u003e\n  \u003ch3\u003eActions\u003c/h3\u003e\n  \u003cul class=\"no-bullet\"\u003e\n    \u003cli\u003e\u003cstrong\u003e\u003cem\u003eDagger.\u003c/em\u003e\u003c/strong\u003e \u003cem\u003eMelee Weapon Attack:\u003c/em\u003e +4 to hit, reach 5 ft., one target. \u003cem\u003eHit:\u003c/em\u003e 4 (1d4 + 2) piercing damage.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003e\u003cem\u003eSling.\u003c/em\u003e\u003c/strong\u003e \u003cem\u003eRanged Weapon Attack:\u003c/em\u003e +4 to hit, reach 30/120 ft., one target. \u003cem\u003eHit:\u003c/em\u003e 4 (1d4 + 2) bludgeoning damage\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/div\u003e\n```\n\n#### Stat Block Preview\n\n![Description Preview](/docs/images/statblock.png)\n\n## Installing Dependencies\n\nInstalling the dependencies is done using a standard ```npm install```.\n\n## Running the Tests\n\nTests are written (and run) using [Jasmine](https://jasmine.github.io/). The following command will run the tests.\n\n```batchfile\nnpm test\n```\n\n## Building the project\n\n```batchfile\nnpm run build\n```\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/trwolfe13/brewdown/tags).\n\n## Authors\n\n* **Tom Wolfe** - *Initial work* - [trwolfe13](https://github.com/trwolfe13)\n\nSee also the list of [contributors](https://github.com/trwolfe13/brewdown/contributors) who participated in this project.\n\n## Credits\n\nA lot of this work would not have been possible were it not for the [Homebrewery project](https://github.com/stolksdorf/homebrewery) developed by [stolksdorf](https://github.com/stolksdorf). It is from that project the styling and graphics are based (and in some cases outright taken).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","funding_links":[],"categories":["CSS"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-wolfe%2Fbrewdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom-wolfe%2Fbrewdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-wolfe%2Fbrewdown/lists"}