Skip to main content

Simple Inline Markup Language and Logging (saimll)

SAIML

This allows the user to customize strings and prettyprint different information to stdout.

Includes:

  • parse -> returns formatted strings
  • print -> parse SAIML markup strings and display them to stdout

Syntax: Brackets [] indicate a macro. Macros can do 1 of three things; Assign a foreground/background color, create a hyperlink, and call a builtin function. All macros will ignore extra whitespace and focus on the identifiers; @, ~, and ^.

  1. Colors

    • Colors start with a leading identifier @. To indicate foreground or background use the specifier F and B respectively. Following the @ and the specifier you can then enter the color.
      • This can be a predifined color such as; black, red, green, yellow, blue, magenta, cyan, white. [@F black].
      • It can be a hex code #ead1a8. [@F #ead1a8].
      • It can be a XTerm code 0-256. [@F 9].
      • Lastely, it can be an rgb color where the 3 numbers can be seperated by a , or a ;. [@F 114;12,212].
    • Colors can be reset with [@F] or [@B] to reset foreground or background respectively or [@] can be use to reset both.
    • Foreground and background can be specified in the same macro [@F 1 @B 2], but they can not be reset in the same macro [@F @B], use [@]` instead.
    • While the macro will ignore white space and you can do something like [@F#ead1a8@B3] it is preferred to use whitespace for readability [@F #ead1a8 @B 3].
  2. Hyperlinks

    • Hyperlinks start with a leading identifier ~.
    • Hyperlinks will surround plain text blocks. [~https://example.com]Example -> Example.
      • Links end on the next macro with the simpl ~ or at the end of the string
        • [~https://example.com]Example[~] Not part of the link → ``Example Not part of the link
        • [~https://example.com]Link1 [~https://example.com]Link2Link1 link2``
  3. Builtin functions

    • Builtin functions start with the identifier ^. The text block following the function will have it's string value passed as a parameter.
    • You can also specify your own function or override the provided ones by calling SAIML.define("Macro Name", Callable)
    • The custom function needs to take a string and return a string. If it does not return a string it will not have an affect.
      • Example:
        def hello_world(string: str)  str:
            return "Hello World"
        
        SAIML.define("hw", hello_world)
        SAIML.print("[^hw]Cat goes moo")
        
      • The above example lets SAIML know about the function hello_world and says it can be called with hw
      • Then all that needs to happen is to call it with [^hw]
    • Example:
      • [^rainbow]Rainbow Text will return the string with a rainbow foreground color. SAIML also follows some inspiration from markdown where * means toggle bold and _ means to toggle underline. To reset all attributes, color and formatting, use the empty brackets [].

Check out this example for how SAIML can be used

Release files for saimll 0.5.1

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

Source distribution (sdist)

Source distribution for saimll 0.5.1
File Size Uploaded
saimll-0.5.1.tar.gz 25.3 kB Details

Built distribution (wheel)

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

Total release size: 53.1 kB

Release files / saimll-0.5.1.tar.gz

Download URL saimll-0.5.1.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4630cdf14f33ff2147e16d0b7842f1d612957d129dfbede6de5ea9b5e992bf38
BLAKE2b-256 checksum
How to use checksums
d0fec94b7a69533f83b6c1b7e13a58d658e950d3d0ba8ae31cd7b6350cc9ba87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / saimll-0.5.1-py3-none-any.whl

Download URL saimll-0.5.1-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a89ddadf4a6d97979d6f011560edbdcd6e61b7c5e270e4924bb9d06fc5633d54
BLAKE2b-256 checksum
How to use checksums
d32773c919cee6d729444b04d32e7cfe5462c332472c1e0ea8c33867332ce39a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

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