Skip to main content

md2linkedin

PyPI version Python versions

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

uv add md2linkedin

Tip: Run the CLI without installing it with uvx md2linkedin post.md.

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 is also uppercased between ━ borders
  • Code spans and blocks: backticks, fences and indent stripped; content rendered in Unicode Monospace (𝚌𝚘𝚍𝚎) by default, or kept plain with --no-monospace-code
  • Links: stripped to display text by default; --preserve-links retains URLs
  • Images: replaced by alt text
  • Bullet lists: -/*/+ → •; nested items get one marker per level (‣, ◦, ▪)
  • Ordered lists: numbered in sequence from the list's first number (1., 1. → 1., 2.)
  • Tables: header row in bold, cells joined by |
  • Strikethrough and highlight: ~~text~~ and ==text== → text, markers dropped
  • Blockquotes: leading > stripped at every level of nesting
  • 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 flattened to one line per row, with a bold header and cells joined by |. Nothing keeps the columns aligned on LinkedIn's proportional font, so wide tables are better rewritten as lists.
  • 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.
  • Markdown extensions: Only CommonMark plus tables, strikethrough, autolinks and ==highlight== are read. Task-list checkboxes stay as literal [ ]/[x] and footnotes are flattened (text[^1] → text^1); see What Gets Transformed.

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

See Also

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:

Metadata

Release files for md2linkedin 0.5.2

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

Source distribution (sdist)

Source distribution for md2linkedin 0.5.2
File Size Uploaded Provenance Actions
md2linkedin-0.5.2.tar.gz 15.1 kB With provenance Details for md2linkedin-0.5.2.tar.gz

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / md2linkedin-0.5.2.tar.gz

Download URL md2linkedin-0.5.2.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3f7bdd3b048b946558ea0b4765088ef7e1605addd5c45b193df215991a6dfd70
BLAKE2b-256 checksum
How to use checksums
856b47663e610b71fcdcec125ac2f6bd52fec4fab3b433c56db42decead3acbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 31, 2026.

Transparency log

Release files / md2linkedin-0.5.2-py3-none-any.whl

Download URL md2linkedin-0.5.2-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8970db5dfb5bc5ebd68d05406673fb9cbd7d50355df07c639bb6c67ec3958da
BLAKE2b-256 checksum
How to use checksums
bff8c8164ebffe427fe9ff7f67f487eddd7ba786015b8b3afb0f297b258ba26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 31, 2026.

Transparency log

Security for md2linkedin 0.5.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for md2linkedin-0.5.2.tar.gz

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 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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