Skip to main content

Bloops is an AoPS-like BBCode to HTML transpiler written in Python, with live-preview and support for Asymptote geometry diagrams.


Quick demo

Index

Features

  • AoPS-Inspired Syntax: Transpiles mathematical environments ([theorem], [lemma], [example], [soln]), code blocks, lists, quotes, and formatted text directly into clean and SEO-friendly HTML.
  • Asymptote Integration: Automatically extracts, caches, and compiles [asy] blocks into SVG vector graphics using Asymptote.
  • Live Preview and Server: Built in real-time preview web-server powered by livereload and watchdog to preview changes instantly into the browser.
  • Math & Syntax Highlighthing: Pre-configured with MathJax v4 for TeX rendering and Highlight.js (Catppuccin Latte/Mocha) for code syntax highlighting.

Demo

Writing a document block by block with bloops -pc running: every save rebuilds index.html and the browser reloads instantly.

https://github.com/user-attachments/assets/cf6a9c69-6478-4bfd-8891-41c8818f6d23

Requirements

  • Python >= 3.12
  • Asymptote (asy executable available in your system PATH) for vector diagram rendering

Installation

Install bloops from PyPI. Here is the PyPI listing.

  • I suggest using uv:
    • Run uv tool install bloops if you'd like to use bloops just as a CLI tool.
    • Run uv add bloops if you you'd like to import bloops as a package in your project.
  • Or, if you want to use pip: run pip install bloops.
  • AUR entry is yet to be added.

Usage

bloops is executed via the CLI module syntax.

Options & Flags

Flag Long Flag Description
-h --help Show help message for usage of bloops.
-V --version Show the version of bloops.
-c --build-cont Watch content.bbcode for changes and continuously rebuild index.html.
-p --preview Launch a local web live-server to preview index.html.
-i --input (Required) Input directory containing content.bbcode.
-o --output Output directory for generated assets (defaults to in_dir/static/).
Help Summary
usage: bloops [-h] [-v] [-c] [-p] -i INDIR [-o OUTDIR]

An AoPS-like BBCode to HTML transpiler written in Python, featuring live-preview support and dynamic Asymptote geometry diagram compilation.

options:
  -h, --help           show this help message and exit
  -v, --version        show program's version number and exit
  -c, --build-cont     convert BBCode to HTML and continuously write to index.html on change
  -p, --preview        run a preview of index.html on the web-browser
  -i, --input INDIR    directory path which contains the BBCode file
  -o, --output OUTDIR  optional directory path where generated Asymptote diagrams are to be saved

Directory Structure

my_document/
├── content.bbcode      # Your source BBCode document
├── index.html          # Generated HTML page
├── build/              # Asymptote build cache and temporary .asy files
└── static/
    ├── style.css       # Stylesheet for rendered document
    └── diagram1.svg    # Compiled Asymptote vector diagrams

Syntax Guide

Bloops uses BBCode syntax inspired by AoPS. Here are reference tables for each BBCode tag bloops uses:

[asy]
Option Mandatory Description
src YES Path to the saved image (relative to content.bbcode).
label YES Label of the diagram which will be used as the filename (must be unique).
width - Width in percentage (without % symbol) relative to the body width.
alt - Alternate text to be shown if the image fails to load.
caption - Caption for the diagram.
[code]
Option Mandatory Description
lang - Language used in the code block (tries to detect the language if argument is not provided).
mode - inline or block (default: block)
[color]
Option Mandatory Description
hex YES Color code in hex (with the leading #).
[img]
Option Mandatory Description
src YES Path to the saved image (relative to content.bbcode).
width - Width in percentage (without % symbol) relative to the body width.
alt - Alternate text to be shown if the image fails to load.
caption - Caption for the image.
[url]
Option Mandatory Description
link YES URL link.
target - Target for opening the URL: [self, blank] (defaults to blank).

self: opens the URL in the current page.

blank: opens the URL in a new page.

[list]
Option Mandatory Description
type - Type of the list: [ul, ol] (defaults to ul).
style - Style of the list marker.

Google “list styles in css” for valid styles.

[quote]
Option Mandatory Description
author - Name of the author.
link - Link to the quote for citation (will not be visible in page, used for SEO).
[hide]
Option Mandatory Description
label YES Label to be used as the summary for hidden details.
math environments

Currently, the following math box tags are supported: [theorem], [lemma], [proposition], [corollary], [example], [claim], [problem], and [exercise].

There is only one option for each math box: title.

Option Mandatory Description
title - An optional title for math boxes to be put within parentheses in the heading.

Apart from these, bloops also provides [proof] and [soln] for proof and solutions.

tags without any options
Tag Purpose
[sidemark][/sidemark] To put a number in the subscript for a sidenote.
[sidenote]<your-note>[/sidenote] To write a note to be put aside.
Tag HTML Counterpart
[b] <strong>
[i] <em>
[u] <u>
[s] <s>
[*] <li>
[sub] <sub>
[sup] <sup>
[h1] <h1>
[h2] <h2>
[h3] <h3>
[h4] <h4>
[h5] <h5>
[h6] <h6>

An example showcasing the use of tags mentioned above has been provided in example/content.bbcode and the corresponding generated HTML file is present in example/index.html.

API Reference

Bloops provides the following public modules and functions:

Module Functions
validator validate_bbcode & compile_asy_diagrams
bloopser convert_bbcode_to_html
bracer gobble_inside_delim, gobble_around_delim, & get_close_delim_end_index

If you want to convert a BBCode text into HTML using bloops, first run validate_bbcode, then compile_asy_diagrams, and finally convert_bbcode_to_html on the text.

Bloops also provides the BBCODE_TAGS global constant under the vars module.

A detailed documentation of these API endpoints can be found in docs/api.md.

FAQs

Q: Why are my images not loading even though the src path is valid?

Answer.

Make sure that the image can be reached without leaving the directory in which index.html and content.bbcode reside. The suggested place for images to reside is at static/ as shown in the example under Directory Structure. In general, the image should be reachable starting from my_document/, as in the example.

This is due to a caveat of python-livereload. The directories that are being used to serve static files need to be registered before the server is launched. Hence, it is not possible to add random directories dynamically into the live-server.


Q: How do I use my own stylesheet?

Answer.

Bloops creates a stylesheet at static/style.css given that the file doesn't already exist; otherwise, it does nothing. So, there are two ways you could use a custom stylesheet:

  • Create/Edit the stylesheet at static/style.css and put your custom style in it.
  • Import a style sheet into static/style.css by adding @import url("<path-to-your-stylesheet>") to static/style.css.

Q: How do I use my own javascript code?

Answer.

Same as the previous FAQ. Use static/script.js.

Contribution

Contributions are very welcome! Please read CONTRIBUTING.md for a guide on how to contribute. I'm against the idea of using AI for writing hobby projects; however, I have no problem if someone else uses them. If you're using AI assistance for contributing, please mention so in your PR. (No AI has been used in this project except for generating docstrings, the Catppuccin Latte/Mocha based CSS stylesheet, and the preview demos/banner.)

TODOs

  • Implement a post-processor which adds paragraph tags around every disjoint block of HTML code.
  • Shift avatar to integration server.
  • Handle [ or ] inside arguments of BBCode tags. (I'll be very glad if someone suggests me a solution for this; I've thought about it myself, but couldn't really come up with anything.)
  • Switch lists to sets to optimize speed.
  • Currently, using BBCODE content inside [code] is broken, since bloops eagerly formats the BBCODE inside [code] too.

↑ Back to top

Metadata

Release files for bloops 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bloops 0.3.3
File Size Uploaded Provenance Actions
bloops-0.3.3.tar.gz 35.1 kB With provenance Details for bloops-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bloops 0.3.3
File Interpreter ABI Platform Actions
bloops-0.3.3-py3-none-any.whl Python 3 none any Details for bloops-0.3.3-py3-none-any.whl

Total release size: 62.6 kB

Release files / bloops-0.3.3.tar.gz

Download URL bloops-0.3.3.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8f93d831b506ac8168395da93f9bfef743e815953c16756a5d5f921f81afcbc4
BLAKE2b-256 checksum
How to use checksums
a01ae8dc3c0a65c33a3fc01a80863695c0fdb7b10f6735235aca5568e839c932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / bloops-0.3.3-py3-none-any.whl

Download URL bloops-0.3.3-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa74ea0ed026043eced3e47b9c249715de58c27453e6d9136e8ce33b8179edf9
BLAKE2b-256 checksum
How to use checksums
eee0d1ba6a75d435c13904661ba9a03a68b872f134b25cec0d5d79a383a0bf30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for bloops 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bloops-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page