GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dcwatson/bbcode: A pure python bbcode parser and formatter.

BranchesTags
Open more actions menu

Latest commit

 

History

126 Commits
126 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
docs
docs
 
 
src/bbcode
src/bbcode
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mkdocs.yml
mkdocs.yml
 
 
pyproject.toml
pyproject.toml
 
 
tests.py
tests.py
 
 
uv.lock
uv.lock
 
 

Repository files navigation

Overview

Latest Package http://pypi.python.org/pypi/bbcode

Source Code https://github.com/dcwatson/bbcode

Documentation https://dcwatson.github.io/bbcode/

CI Status

Installation

The easiest way to install the bbcode module is with pip, e.g.:

pip install bbcode

Requirements

Python 3.9+

Basic Usage

# Using the default parser.
import bbcode

html = bbcode.render_html(text)

# Installing simple formatters.
parser = bbcode.Parser()
parser.add_simple_formatter("hr", "<hr />", standalone=True)
parser.add_simple_formatter("sub", "<sub>%(value)s</sub>")
parser.add_simple_formatter("sup", "<sup>%(value)s</sup>")


# A custom render function.
def render_color(tag_name, value, options, parent, context):
    return '<span style="color:%s;">%s</span>' % (tag_name, value)


# Installing advanced formatters.
for color in ("red", "blue", "green", "yellow", "black", "white"):
    parser.add_formatter(color, render_color)

# Calling format with context.
html = parser.format(text, somevar="somevalue")

About

A pure python bbcode parser and formatter.

Topics

bbcodemarkuppython

Resources

Readme
BSD-2-Clause license
Activity

Stars

74 stars

Watchers

5 watching

Forks

18 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.