line-markdown-parser
Convert LLM Markdown into readable LINE Flex Message dictionaries with no runtime dependencies.
Headings, paragraphs, lists, quotes, code, and links receive a chat-friendly layout. Long output is split into separate messages. Sending remains the responsibility of your application.
Installation
Requires Python 3.10 or later.
python -m pip install line-markdown-parser
Quick start
import json
from line_markdown_parser import convert_markdown_to_line_messages
markdown = """# Project update
The **first draft** is ready.
- Review the examples
- Read the [guide](https://example.com/guide)
"""
messages = convert_markdown_to_line_messages(markdown)
print(json.dumps(messages, ensure_ascii=False, indent=2))
Each item has type: "flex", altText, and one bubble in contents. Pass these dictionaries to your LINE API integration. The library makes no network requests and does not require the LINE SDK.
The converter returns all generated messages. LINE accepts up to five message objects per reply or push request, so your application must handle longer results and reply-token restrictions.
API
All functions are exported from line_markdown_parser.
| Function | Purpose |
|---|---|
convert_markdown_to_line_messages |
Split Markdown and return a list[dict] of Flex Messages. |
build_flex_message |
Build one message without splitting; reject oversized input. |
build_flex_contents |
Build body components for a custom bubble, without a bubble size check. |
split_long_text |
Return Markdown chunks as a list[str]. |
estimate_flex_payload_size |
Measure the rendered bubble's compact UTF-8 JSON size. |
The converter defaults to 1,600 source characters and 28,000 rendered bytes per chunk. See the API specification for signatures, limits, alternative text, and error behavior.
Limitations
- Markdown tables use code-style text boxes; column alignment varies by client font.
- Images appear as labels and links, without fetching or embedding images.
- Only
httpandhttpslinks receive URI actions; destinations are not verified. - Full CommonMark support, arbitrary nesting, and every code-fence style are outside the scope.
- This is an alpha release with automated tests. Live LINE delivery and client appearance have not been verified. Check integration with the Flex Message Simulator and your target LINE clients.
Contributing
See CONTRIBUTING.md for setup and checks, SECURITY.md for vulnerability reporting, and CHANGELOG.md for release history.
License
MIT. This independent project is not an official LINE product.
Metadata
Release files for line-markdown-parser 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| line_markdown_parser-0.1.2.tar.gz | 25.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| line_markdown_parser-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.6 kB
Release files / line_markdown_parser-0.1.2.tar.gz
| Download URL | line_markdown_parser-0.1.2.tar.gz |
|---|---|
| Size | 25.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7c714d902921c2dba9690e09f2c3155bd83228c863d59a2ffc3eac99916a279
|
|
BLAKE2b-256 checksum How to use checksums |
a8c240bf08c938fe6f6baafd044591fff6b50862fa8c4e894061dc1d44f64865
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 17, 2026.
Transparency logRelease files / line_markdown_parser-0.1.2-py3-none-any.whl
| Download URL | line_markdown_parser-0.1.2-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f26dc99b004d00bfb7f3f1b9bf338955f7944c107869d7ed369ec802f0238517
|
|
BLAKE2b-256 checksum How to use checksums |
26db0abd14dc1cc705ad15298b910b8c96cc2263af5f925938661843b6784b86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 17, 2026.
Transparency log