Skip to main content

Convert Markdown to LinkedIn-friendly Unicode text

Project description

md2linkedin

PyPI version Python versions PyPI Downloads

md2linkedin converts Markdown text to LinkedIn-compatible plain text by replacing bold, italic, and bold-italic markers with Unicode Mathematical Sans-Serif characters. This preserves visual formatting when pasting into platforms like LinkedIn that do not support Markdown natively.

Installation

Package Manager Installation Command
pip pip install md2linkedin
uv uv add md2linkedin

Usage

Python API

# @pyodide
from md2linkedin import convert

md = """
# Exciting News

I'm thrilled to share that **we just launched** a new product!

Key highlights:

- **Performance**: *3x faster* than the previous version
- **Reliability**: ***zero downtime*** deployments
- **Developer UX**: clean, intuitive API

Check it out and let me know what you think.
"""

print(convert(md))
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
𝗘𝗫𝗖𝗜𝗧𝗜𝗡𝗚 𝗡𝗘𝗪𝗦
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

I'm thrilled to share that 𝘄𝗲 𝗷𝘂𝘀𝘁 𝗹𝗮𝘂𝗻𝗰𝗵𝗲𝗱 a new product!

Key highlights:
• 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲: 3𝘹 𝘧𝘢𝘴𝘵𝘦𝘳 than the previous version
• 𝗥𝗲𝗹𝗶𝗮𝗯𝗶𝗹𝗶𝘁𝘆: 𝙯𝙚𝙧𝙤 𝙙𝙤𝙬𝙣𝙩𝙞𝙢𝙚 deployments
• 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿 𝗨𝗫: clean, intuitive API

Check it out and let me know what you think.

CLI

# Convert a Markdown file (output: post.linkedin.txt)
md2linkedin post.md

# Specify output path
md2linkedin post.md -o linkedin_post.txt

# Pipe from stdin
echo "**Hello**, *world*!" | md2linkedin

# Keep link URLs in the output
md2linkedin post.md --preserve-links

# Disable monospace code rendering
md2linkedin post.md --no-monospace-code

Key Features

  • Bold: **text** or __text__ → Unicode Sans-Serif Bold (𝗯𝗼𝗹𝗱)
  • Italic: *text* or _text_ → Unicode Sans-Serif Italic (𝘪𝘵𝘢𝘭𝘪𝘤)
  • Bold-italic: ***text*** or ___text___ → Unicode Sans-Serif Bold Italic (𝙗𝙤𝙡𝙙-𝙞𝙩𝙖𝙡𝙞𝙘)
  • Headers: #/##/etc. styled with bold Unicode; H1 gets a border
  • Code spans: backticks stripped, content rendered in Unicode Monospace (𝚌𝚘𝚍𝚎) by default; --no-monospace-code keeps plain text
  • Fenced code blocks: fences stripped and content rendered in Unicode Monospace by default; --no-monospace-code preserves verbatim
  • Links: stripped to display text by default; --preserve-links retains URLs
  • Images: replaced by alt text
  • Bullet lists: -/*/+; nested items →
  • Blockquotes: leading > stripped
  • HTML spans: unwrapped, inner text preserved
  • HTML entities: decoded (&&, etc.)
  • Backslash escapes: resolved (\**)
  • Windows line endings: normalised automatically
  • Emojis & non-ASCII: pass through unchanged — no accidental corruption

Limitations

Converting Markdown to LinkedIn-friendly text relies on Unicode Mathematical Alphanumeric Symbols to simulate styling. This approach has notable limitations:

  • Code Blocks: Monospace Unicode characters do not enforce true fixed-width alignment on proportional fonts (like LinkedIn’s default font). As a result, indentation and column alignment in code blocks will often break visually.
  • Tables: Markdown tables are not converted — they pass through as raw pipe syntax (| col | col |), which LinkedIn does not render, producing unreadable output.
  • Accessibility: Screen readers often read Unicode mathematical characters aloud individually (e.g., “mathematical sans-serif bold b”) instead of as complete words, making the content difficult for visually impaired users to understand.
  • Searchability: Text styled with these Unicode characters may not be indexed properly by LinkedIn’s search algorithm, meaning people searching for your keywords might not find your post.

For more examples, check out the package documentation at: https://www.indrapatil.com/md2linkedin/

License

This project is licensed under the MIT License.

Code of Conduct

Please note that the md2linkedin project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Acknowledgements

Hex sticker font is Rubik. Icons are sourced from Flaticon:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md2linkedin-0.2.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md2linkedin-0.2.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file md2linkedin-0.2.1.tar.gz.

File metadata

  • Download URL: md2linkedin-0.2.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for md2linkedin-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4c4cf446e0b4134a2f7bb0c72255ff09da2f8a8ed9f2bc002a0146ba2cd11f9c
MD5 dbd07b41c1837af9a203c395c2383747
BLAKE2b-256 b1832681c735573f5d951c48e1dcd7adeb5577ea41ed6dfefdfeb563521f74c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2linkedin-0.2.1.tar.gz:

Publisher: release.yml on IndrajeetPatil/md2linkedin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file md2linkedin-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: md2linkedin-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for md2linkedin-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bef2e5aa13a872ddb125fc03149bae1849ee079efd80bc30a5bc45febf876da
MD5 bc661eb8de8dad71dddfd4581187cc97
BLAKE2b-256 db1325ef6ff8adfb8da28502194cc91ee9a0b64334175ac64f0c5fa7cbb131f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2linkedin-0.2.1-py3-none-any.whl:

Publisher: release.yml on IndrajeetPatil/md2linkedin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page