Skip to main content

Checkmark

Checkmark lets you quickly and easily set up a way for you or any other user to submit data to your program through an HTML form. Using a Markdown-like document, you can specify a plethora of form elements.

Form elements

Example

from checkmark import MarkdownForm

document = """
:[Username](username)
>[Username](username "Ex. @user:domain.tld")
:[Password](password)
>[Password](password "Choose something not too simple.")

<!-- A button that calls the `register` API method. -->
@[Register](register)
"""

form = MarkdownForm(
    title='My Markdown Form',
    document=document
)

# Define a function to be called
# when you press the `Register` button.

@form.api_method
def register(data):
    username = data.get('username', "")
    password = data.get('password', "")

    form.update(data, keys=['username', 'password'])

    print(f'Successfully registered as {username}')
    print(f'Your password is {"*" * len(password)}.')

form.start()

You can try it out with the example below.

# Account

## Registration

:[Username](username)
>[Ex. @michael:duckduckgo.com](username "@user:domain.tld")<br>
:[Password](password)
>[password123](password "Choose something not too simple.")<br>
:[Email](email)
>[Ex. user@domain.tld](email "So that you can confirm your account.")<br>

[x] [Sign me up to the newsletter](newsletter)

>>[My hobbies are ...](hobbies "What do you like to do during your free time?")

@[Register](register "Register new account.")


## Settings

## layout:
* [IRC](irc)
* [Modern](modern)
* [Message bubbles](bubbles)

## language:
- [Swedish](se)
- [English](en)
- [French](fr)

@[Save settings](save_settings)

Rules

Inlines

Inline elements can be written anywhere on the line. As long as the pattern is matched, it should create an element in the right place.

Link

This is not a custom element of its own. It's a description of how the standard Markdown link format is used within other custom elements.

In any and all definitions, if something looks like a Markdown link, it is a Markdown link and should be structured like one. It follows the same rules as regular Markdown and so the title is optional.

The title is always used as the title argument for any Checkmark element in which it is specified.

[Text](url "Title.")

Label

Labels are simply aesthetic and don't affect the functionality of the form. The URL is only used to define the for argument.

:[Super Label](best-label)

Text & TextArea

Text uses one > as prefix and TextArea uses two. The text of the link is used as the placeholder argument.

TextArea
>>[My hobbies are ...](hobbies "What do you like to do during your free time?")
Text
>[Username](username "Ex. @user:domain.tld")

Checkbox

[x] [I understand how checkboxes work.](understood)

Button

Call one of the provided API methods using a button, with the URL as the function name.

@[Log in](log_in)

Lists

A list has a variable name and the possible values for it. The variable name is defined by a preceding heading's Markdown link URL. The URLs of the entries are used for the values. Any empty lines terminate the list, whether between entries or the entries and the heading.

Radio Buttons

Radio button entries use * as prefix.

## [Message layout](layout):
* [IRC](irc)
* [Modern](modern)
* [Message bubbles](bubbles)

Dropdown Menu

Dropdown menu entries use - as prefix.

## [Language](language):
- [Swedish](se)
- [English](en)
- [French](fr)

Extensible List (Not yet implemented)

I will be adding lists that allow you to define multiple types of elements per entry and with a + button, you will be able to add new multi-element entries into the list.

The future syntax will look a little something like this:

# advanced-dns:
+ ## type:
  - [A Record](a)
  - [CNAME Record](cname)
  - [TXT Record](txt)
+ >[Host](host)
+ >[Port](port)
+ [x] [Backward compatible](backcomp)

This list would include a dropdown menu, two text inputs, and a checkbox. I'll describe it more in detail once I get it implemented.

Metadata

Release files for checkmark 1.7.4

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

Source distribution (sdist)

Source distribution for checkmark 1.7.4
File Size Uploaded
checkmark-1.7.4.tar.gz 23.5 kB Details

Built distribution (wheel)

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

Total release size: 46.9 kB

Release files / checkmark-1.7.4.tar.gz

Download URL checkmark-1.7.4.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6192d1606c01bb888973018f5ef87c59e2ec87aac61c07202a63bcca65fe5232
BLAKE2b-256 checksum
How to use checksums
e0c1d9727d63fa93853b8c1b321ef95150ddee37c2cc7cad65ec3945d3248fa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Linux/5.10.93-1-MANJARO

Release files / checkmark-1.7.4-py3-none-any.whl

Download URL checkmark-1.7.4-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1332c941e6c09dbd8a95aaa56563fff3443880be41db4e5baf30013627db110d
BLAKE2b-256 checksum
How to use checksums
c4025234dc6a95848ebc300b97bfbf955ce4ad0421b53eadccbf9405abdddd6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Linux/5.10.93-1-MANJARO

Release history Release notifications | RSS feed

This release

1.7.4 This release

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.2.0

2 release files

1.0.0

2 release files

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