Introduction
This package offers editor tools that help users write Steam guides and reviews.
This package supports:
- Steam information queries
- Image editing tools
- BBCode text processing tools
Users can write their documents with Markdown, use this package to process the images in the document, and convert the document to the Steam BBCode format.
Usage
The following minimal example shows a simple customization, where we convert a Markdown file into Steam BBCode, and print each header during the conversion.
- Python
- Markdown
- BBCode
import os
import steam_editor_tools as stet
def convert(file_path: str) -> None:
out_file_path = os.path.splitext(file_path)[0].strip() + ".bbcode"
doc = stet.DocumentParser().parse_file(file_path)
with open(out_file_path, "w", encoding="utf-8") as fobj:
fobj.write(stet.BBCodeRenderer().render(doc))
convert("example.md")
## An example file
> <cite>Author</cite>
>
> - Example **bold** text
> - Example _italic_ text
| Example | Table |
| :------------ | :------------------: |
| Something new | `some [code][/code]` |
[h2]An example file[/h2]
[quote=Author]
[list]
[*]Example [b]bold[/b] text
[*]Example [i]italic[/i] text
[/list]
[/quote]
[table]
[tr][th]Example[/th][th]Table[/th][/tr]
[tr][td]Something new[/td][td][noparse]some [code][/code][/noparse][/td][/tr]
[/table]
Features
Currently, we support the following features:
Steam information query
| Functionality | Description |
|---|---|
| Search app by name | Given the partial name of an app (game), search for its information, including the ID. Support fuzzy searching. |
| Get app details by ID | Given the app ID, fetch the full details, including the name, description, price, about page, and other information. |
| Download images | Use methods such as get_header_image() to get the header image, background image, and official screenshots on the store page. |
| Download achievements | Download the achievements of a specific game. Then, dump the information as a BBCode file and save the icon images in a specific folder. |
Image editing tools
| Functionality | Description |
|---|---|
| Image stack | A code-based image editor, allowing users to stack multiple layers of images, texts, or LaTeX equations with styles. |
| Image anchor | Inspired by LaTeX's TikZ package, this package allows users to place images on the same canvas by using their relative positions. |
| Image optimization | Users only need to specify the quality and the saving format. The package can choose the best way to optimize the saved image size. |
| Image modifications | Basic image modification tools such as image resizing, cropping and blurring. |
| Image effects | Features mimicing the "Layer blending options" of the image editor, allowing users to add stroke, shadows, and other effects to an existing layer. |
| Thumbnail | Provide an option to create Steam-compatible thumbnails. This feature is useful when users need to upload screenshots by themselves. |
| Batch processing | Walk through a folder, apply a customized image processing function to each image, and save the results with thumbnails in another folder. |
| Font searching | Perform fuzzy searches for system or customized fonts. Users can provide a list of fallback options. |
Actually, the title banner of this Readme file is created by the image editing tools. See the examples.
You need to have a locally installed LaTeX released version like TeXLive to use the equation features.
BBCode text processing tools
| Functionality | Description |
|---|---|
| Structured data | All conversions are divided into two steps: Other formats -> Document stucture -> Steam BBCode. The intermediate Document strcture is supported by pydantic. |
| HTML to BBCode | Recursively parse an HTML file, and convert it into Document or Steam BBCode. |
| Markdown to BBCode | Use markdown-it to convert a Markdown file to HTML, then convert the HTML to Document or BBCode. |
| Read BBCode | Use bbcode to load a BBCode file. The loaded file can be rendered with style customizations. |
| Fetch a Steam guide | Given the URL of a Steam guide, convert it into Document or BBcode. |
Why using this package
- Compared to other BBCode conversion packages such as html2bbcode and html2phpbbcode, our package strictly follows the current Steam BBCode format. Different forums may have different BBCode standards.
- Compared to ihroteka-converter, we fully support every format provided by Steam. Unlike that regular-expression-based conversion, the BBCode reconstruction in this package is based on a recursive analysis of the HTML structure. Therefore, our package will not omit any text as long as it appears in the original document.
- We offer flexibility of customization. Users can inject any rendering step of this package by simply overriding the methods of
steam_editor_tools.bbcode.BBCodeRenderer. For example, we can customize aBBCodeRendererto create a title image for each header. - We offer convenient approaches for integrating the store page information into the output data. For example, users can easily convert a store page to BBCode if needed.
Related materials
Changelog:
License of this project:
Guidelines for the contributions:
Contributor covenant code of conduct:
Security policy: