HastyScribe

repository·master·Indexed 42 days ago

https://github.com/h3rald/hastyscribe

A 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.

Tokens
7.5K
Snippets
36
Records
52
Agent score
48%

What's inside HastyScribe

  1. Overview of HastyScribe

    master
    HastyScribe (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 .HTML file 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.
  2. Embed images and fonts automatically

    master

    HastyScribe 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.
  3. Transclude external files with heading offsets

    master

    You 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 1 will turn an ## h2 into an ### h3.

    Important Constraints:

    • Heading Syntax: Offset only works if headings are created using # syntax. Underline syntax for h1 and h2 is 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 @}
  4. Use Discount extensions for advanced Markdown formatting

    master

    HastyScribe uses the Discount markdown 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.
  5. Use Class Blocks for specialized content containers

    master

    HastyScribe supports the definition of class blocks: <div> elements with a specific class attribute. 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.
  6. Use FontAwesome icons and special callout blocks

    master

    HastyScribe 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).