HastyScribe
repository·master·Indexed 42 days ago
https://github.com/h3rald/hastyscribeA command-line utility and Nim library for converting Markdown files into self-contained, responsive HTML documents. It features automatic asset embedding via Data URIs, support for Discount extensions, content transclusion, text snippets, and specialized callout blocks for notes, tips, and warnings.
What's inside HastyScribe
- HastyScribe is a simple command-line program designed to convert Markdown files into HTML files. It supports processing multiple files or using glob expressions to handle batches of files at once.
Overview of HastyScribe
masterHastyScribe (hs) is a self-contained Markdown compiler designed to create single-file, well-formed HTML documents. It is optimized for easy distribution by embedding all necessary assets—including stylesheets, fonts (HastyScribe, FontAwesome, Source Sans Pro, and Source Code Pro), and images—directly into the output.HTMLfile using the Data URI scheme. The resulting documents are responsive (mobile-friendly) and include specific styles for printed media, such as proper pagination and headers/footers with page numbers.Embed images and fonts automatically
masterHastyScribe ensures the output is a single, dependency-free file by:
- Automatically embedding all referenced images (both local and remote) using the Data URI scheme.
- Automatically embedding the HastyScribe, FontAwesome, Source Sans Pro, and Source Code Pro fonts.
Transclude external files with heading offsets
masterYou can include the contents of another file into your current document using the transclusion syntax:
{@ filename.md || offset @}.Heading Offset It is mandatory to specify a number between 0 and 5 as the offset. This number determines how much the heading levels in the transcluded file are shifted. For example, an offset of
1will turn an## h2into an### h3.Important Constraints:
- Heading Syntax: Offset only works if headings are created using
#syntax. Underline syntax forh1andh2is not supported. - File Paths: It is recommended to keep transcluded files in the same folder as the main file. Relative paths for images inside transcluded files are interpreted relative to the transcluding file.
{@ my-file.md || 1 @}- Heading Syntax: Offset only works if headings are created using
Manage long documents with Content Transclusion
masterTo manage large projects, you can split your content into multiple files and use transclusion to pull those files into a single master document during compilation.Use Discount extensions for advanced Markdown formatting
masterHastyScribe uses the
Discountmarkdown compiler under the hood. This allows you to use extensions beyond standard Markdown, such as:- Creating notes and sidebars using specific block formatting.
- Styling text using CSS classes.
- Creating definition lists and alphabetical lists.
Use Class Blocks for specialized content containers
masterHastyScribe supports the definition of class blocks:
<div>elements with a specificclassattribute. The syntax follows the pattern used for block quotes, but requires the class name to be wrapped in%symbols on the first line of the block.Each block must start with a
>(block quote) character on every line.> %class-name% > Content goes here.Reuse content with Text Snippets
masterYou can define and use text snippets to reuse content throughout a document. This is useful for repeating frequently used sentences, formatted blocks, or shortening long words.Define Substitution Macros for text reuse
masterFor text chunks that follow a consistent format but vary slightly in content, you can define simple text substitution macros to achieve high content reuse.Include Custom Fields and dynamic values
masterHastyScribe supports fields to include dynamic information such as the current date or time. It also allows you to pass custom values into the document via command-line parameters.Use FontAwesome icons and special callout blocks
masterHastyScribe supports FontAwesome icons for customizing text or badges. It also provides built-in semantic callout blocks for different types of information:
- Tips (
%tip%) - Notes (
%note%) - Warnings (
%warning%) - Sidebars (
%sidebar%)
You can also use CSS classes for custom elements like comment badges (e.g.,
class:draftcomment).- Tips (
Install HastyScribe using Nimble
masterIf you have Nim installed on your system, you can install HastyScribe directly using the Nim package manager, Nimble.
nimble install hastyscribe