### Install md2linkedin via Package Managers Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/index.md Commands to install the package using pip or uv. ```bash pip install md2linkedin ``` ```bash uv add md2linkedin ``` -------------------------------- ### Convert Markdown using CLI Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/index.md Command-line interface examples for file conversion, piping input, and configuring output options. ```bash # 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 ``` -------------------------------- ### Run via uvx Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Executes the tool without requiring a permanent installation. ```bash # Convert a Markdown file uvx md2linkedin post.md # Pipe from stdin echo "**bold** and *italic*" | uvx md2linkedin # Preserve link syntax uvx md2linkedin --preserve-links post.md # Explicit output path uvx md2linkedin post.md -o linkedin_post.txt # Disable monospace code rendering uvx md2linkedin --no-monospace-code post.md ``` -------------------------------- ### Install R Dependencies for Hex Sticker Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/hextools/README.md Installs the required R packages: hexSticker, magick, and showtext. Ensure these are installed before running the logo generation script. ```r install.packages(c("hexSticker", "magick", "showtext")) ``` -------------------------------- ### Run md2linkedin with uvx Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Execute the tool without permanent installation using uvx. This approach is ideal for occasional use and automatically handles environment isolation. ```bash # Convert a Markdown file (output: post.linkedin.txt) uvx md2linkedin post.md # Pipe from stdin echo "**bold** and *italic*" | uvx md2linkedin # Preserve link syntax uvx md2linkedin --preserve-links post.md # Explicit output path uvx md2linkedin post.md -o linkedin_post.txt # Disable monospace code rendering uvx md2linkedin --no-monospace-code post.md ``` -------------------------------- ### Convert Markdown to LinkedIn Text using Python API Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/README.md Use the `convert` function from the `md2linkedin` library to transform Markdown strings into plain text with Unicode formatting suitable for LinkedIn. Ensure the library is installed. ```python # @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)) ``` -------------------------------- ### CLI Reference Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Overview of available command-line options and usage syntax. ```text Usage: md2linkedin [OPTIONS] [INPUT_FILE] Convert Markdown to LinkedIn-friendly Unicode text. Options: -o, --output PATH Output file path. --preserve-links Keep link syntax in output. --no-monospace-code Disable monospace Unicode rendering for code. -V, --version Show the version and exit. -h, --help Show this message and exit. ``` -------------------------------- ### Use the CLI for conversion Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Executes Markdown conversion tasks directly from the command line. ```bash # Convert a Markdown file (output: post.linkedin.txt) md2linkedin post.md # Specify custom 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 # Show version md2linkedin --version # Show help md2linkedin --help ``` -------------------------------- ### Convert Markdown Files Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Use convert_file() to process .md files and optionally specify an output path. ```python from md2linkedin import convert_file out = convert_file("post.md") print(f"Written to: {out}") # post.linkedin.txt # Override the output path out = convert_file("post.md", "my_post.txt") ``` -------------------------------- ### CLI Interface Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Command line interface for converting Markdown files or stdin input to LinkedIn-compatible text. ```APIDOC ## CLI Usage ### Description Convert Markdown files or piped input to LinkedIn-ready text via the command line. ### Parameters #### Query Parameters - **input_file** (string) - Required - Path to the Markdown file. - **-o** (string) - Optional - Specify custom output path. - **--preserve-links** (boolean) - Optional - Keep link URLs in the output. - **--no-monospace-code** (boolean) - Optional - Disable monospace code rendering. ``` -------------------------------- ### Integrate with Pandoc Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts external formats like LaTeX to LinkedIn text using Pandoc piping. ```bash # LaTeX to LinkedIn via command line pandoc --from=latex --to=markdown_strict --wrap=none resume.tex | md2linkedin ``` ```python import subprocess from pathlib import Path from md2linkedin import convert # LaTeX to LinkedIn via Python result = subprocess.run( ["pandoc", "--from=latex", "--to=markdown_strict", "--wrap=none"], input=Path("resume.tex").read_text(), capture_output=True, text=True, check=True, ) linkedin_text = convert(result.stdout) print(linkedin_text) ``` -------------------------------- ### convert_file() Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Reads a Markdown file and writes the converted output to a file. ```APIDOC ## convert_file(input_path, output_path=None, **kwargs) ### Description Reads a Markdown file and writes the converted output to a .linkedin.txt file or a specified path. ### Parameters #### Request Body - **input_path** (str) - Required - Path to the source Markdown file. - **output_path** (str) - Optional - Custom path for the output file. - **kwargs** (dict) - Optional - Additional arguments passed to the convert function (e.g., preserve_links, monospace_code). ### Response - **out_path** (Path) - The path of the written file. ``` -------------------------------- ### apply_style() Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Applies a specified Unicode style dynamically to a given string. ```APIDOC ## apply_style(text, style) ### Description A convenience function that applies a specified style dynamically at runtime. ### Parameters #### Request Body - **text** (string) - Required - The input string to style. - **style** (string) - Required - The style to apply (e.g., 'bold', 'italic', 'bold_italic'). ``` -------------------------------- ### Apply Unicode Styles Directly Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Use public mapping functions or apply_style to format strings with specific Unicode styles. ```python from md2linkedin import ( to_sans_bold, to_sans_italic, to_sans_bold_italic, to_monospace, apply_style, ) to_sans_bold("Open to Work") # 𝗢𝗽𝗲𝗻 𝘁𝗼 𝗪𝗼𝗿𝗸 to_sans_italic("3 years of exp") # 3 𝘺𝘦𝘢𝘳𝘴 𝘰𝘧 𝘦𝘹𝘱 to_sans_bold_italic("Key insight") # 𝙆𝙚𝙮 𝙞𝙣𝙨𝙞𝙜𝙝𝙩 to_monospace("print('hi')") # 𝚙𝚛𝚒𝚗𝚝('𝚑𝚒') # Dynamic dispatch apply_style("Hiring!", "bold") ``` -------------------------------- ### Programmatic File Conversion Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Convert Markdown files to LinkedIn-compatible text files, with options to specify output paths. ```APIDOC ## Programmatic File Conversion ### Description Reads a Markdown file, converts its content, and writes it to a text file. ### Method `convert_file(input_path: str, output_path: Optional[str] = None, preserve_links: bool = False, monospace_code: bool = True) -> Path` ### Parameters #### Arguments - **input_path** (str) - Required - The path to the input Markdown file. - **output_path** (str, optional) - The path for the output text file. If not provided, defaults to `input_path.txt` with `.linkedin.txt` suffix. - **preserve_links** (bool) - Optional - If True, Markdown link syntax `[text](url)` is preserved. Defaults to False. - **monospace_code** (bool) - Optional - If True, code blocks and inline code are rendered in monospace Unicode. Defaults to True. ### Request Example ```python from md2linkedin import convert_file # Convert 'post.md' to 'post.linkedin.txt' out = convert_file("post.md") print(f"Written to: {out}") # Convert 'post.md' to a custom output file 'my_post.txt' out_custom = convert_file("post.md", "my_post.txt") print(f"Written to: {out_custom}") # Convert with link preservation out_links = convert_file("post.md", preserve_links=True) ``` ``` -------------------------------- ### Convert Markdown File Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Reads a Markdown file and writes the converted output to a .linkedin.txt file. ```python from md2linkedin import convert_file from pathlib import Path # Convert file with default output (post.md -> post.linkedin.txt) out_path = convert_file("post.md") print(f"Written to: {out_path}") # Output: Written to: post.linkedin.txt # Specify custom output path out_path = convert_file("post.md", "my_linkedin_post.txt") print(f"Written to: {out_path}") # Output: Written to: my_linkedin_post.txt # Preserve links in output out_path = convert_file("post.md", preserve_links=True) # Disable monospace code rendering out_path = convert_file("post.md", monospace_code=False) # Read the converted content content = out_path.read_text(encoding="utf-8") print(content) ``` -------------------------------- ### convert() Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts a Markdown string into LinkedIn-compatible Unicode plain text, supporting various formatting options. ```APIDOC ## convert(text, preserve_links=False, monospace_code=True) ### Description Converts a Markdown string to LinkedIn-compatible Unicode plain text. Handles bold, italic, bold-italic, headers, code spans, links, images, bullet lists, blockquotes, and HTML entities. ### Parameters #### Request Body - **text** (str) - Required - The Markdown formatted string to convert. - **preserve_links** (bool) - Optional - If True, keeps link syntax instead of stripping URLs. - **monospace_code** (bool) - Optional - If True, renders code spans in monospace Unicode. ### Response - **result** (str) - The converted LinkedIn-compatible text. ``` -------------------------------- ### Run R Script to Generate Logo Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/hextools/README.md Executes the R script 'script.R' from the repository root to generate the hex sticker logo. The output is saved to 'docs/assets/logo.png'. ```bash Rscript hextools/script.R ``` -------------------------------- ### Programmatic String Conversion Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Convert Markdown strings directly in memory to LinkedIn-compatible plain text. ```APIDOC ## Programmatic String Conversion ### Description Converts a Markdown string to a plain-text string suitable for LinkedIn. ### Method `convert(markdown_string: str, preserve_links: bool = False, monospace_code: bool = True) -> str` ### Parameters #### Arguments - **markdown_string** (str) - Required - The Markdown content to convert. - **preserve_links** (bool) - Optional - If True, Markdown link syntax `[text](url)` is preserved. Defaults to False. - **monospace_code** (bool) - Optional - If True, code blocks and inline code are rendered in monospace Unicode. Defaults to True. ### Request Example ```python from md2linkedin import convert result = convert("**Hello**, *world*!") print(result) # Output: 𝗛𝗲𝗹𝗹𝗼, 𝘸𝘰𝘳𝘭𝘥! result_with_links = convert("[GitHub](https://github.com)", preserve_links=True) print(result_with_links) # Output: [GitHub](https://github.com) result_plain_code = convert("`code`", monospace_code=False) print(result_plain_code) # Output: `code` ``` ``` -------------------------------- ### Preserve Markdown Links Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Enable preserve_links=True to keep link syntax instead of stripping it to plain text. ```python result = convert("[GitHub](https://github.com)", preserve_links=True) # [GitHub](https://github.com) result = convert_file("post.md", preserve_links=True) ``` -------------------------------- ### Integrate LaTeX with Pandoc Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Convert LaTeX files to LinkedIn-friendly text by piping through Pandoc. This can be done via shell command or Python subprocess. ```bash pandoc --from=latex --to=markdown_strict --wrap=none resume.tex | md2linkedin ``` ```python import subprocess from md2linkedin import convert result = subprocess.run( ["pandoc", "--from=latex", "--to=markdown_strict", "--wrap=none"], input=Path("resume.tex").read_text(), capture_output=True, text=True, check=True, ) linkedin_text = convert(result.stdout) ``` -------------------------------- ### Apply styles dynamically Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Uses the apply_style function to programmatically select and apply text styles. ```python from md2linkedin import apply_style # Apply bold style result = apply_style("hello", "bold") print(result) # Output: 𝗵𝗲𝗹𝗹𝗼 # Apply italic style result = apply_style("hello", "italic") print(result) # Output: 𝘩𝘦𝘭𝘭𝘰 # Apply bold-italic style result = apply_style("hello", "bold_italic") print(result) # Output: 𝙝𝙚𝙡𝙡𝙤 # Dynamic style selection styles = ["bold", "italic", "bold_italic"] for style in styles: print(f"{style}: {apply_style('Hiring!', style)}") # Output: # bold: 𝗛𝗶𝗿𝗶𝗻𝗴! # italic: 𝘏𝘪𝘳𝘪𝘯𝘨! # bold_italic: 𝙃𝙞𝙧𝙞𝙣𝙜! ``` -------------------------------- ### Convert Markdown Strings Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Use convert() to transform a Markdown string into LinkedIn-ready plain text. ```python from md2linkedin import convert result = convert("**Hello**, *world*!") print(result) # 𝗛𝗲𝗹𝗹𝗼, 𝘸𝘰𝘳𝘭𝘥! ``` -------------------------------- ### Handle Nested Formatting Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md The library processes bold-italic markers before other styles to ensure correct nesting. ```python convert("***very important***") # → bold-italic Unicode convert("**bold and *italic* inside**") # → bold wrapping italic ``` -------------------------------- ### Configure Code Block Rendering Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Control whether code blocks are converted to Unicode monospace characters or kept as plain text. ```python convert("Use `**bold**` in Markdown") # → Use **𝚋𝚘𝚕𝚍** in Markdown (backticks stripped, letters monospaced, ** kept) convert("```\nprint('hi')\n```") # → 𝚙𝚛𝚒𝚗𝚝('𝚑𝚒') (fences stripped, content monospaced) ``` ```python convert("Use `**bold**` in Markdown", monospace_code=False) # → Use **bold** in Markdown (backticks stripped, content as plain text) convert("```\n**not bold**\n```", monospace_code=False) # → ```\n**not bold**\n``` (fenced block fully preserved) ``` -------------------------------- ### Convert text to sans-bold-italic Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Applies sans-bold-italic Unicode styling to input strings. ```python result = to_sans_bold_italic("Hello, World!") print(result) # Output: 𝙃𝙚𝙡𝙡𝙤, 𝙒𝙤𝙧𝙡𝙙! ``` ```python result = to_sans_bold_italic("Key insight") print(result) # Output: 𝙆𝙚𝙮 𝙞𝙣𝙨𝙞𝙜𝙝𝙩 ``` -------------------------------- ### Direct Unicode Mapping Functions Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Apply specific Unicode styles (bold, italic, monospace) directly to strings. ```APIDOC ## Direct Unicode Mapping Functions ### Description Provides functions to directly apply specific Unicode styles to plain strings. ### Functions - **to_sans_bold(text: str) -> str**: Converts text to bold sans-serif Unicode. - **to_sans_italic(text: str) -> str**: Converts text to italic sans-serif Unicode. - **to_sans_bold_italic(text: str) -> str**: Converts text to bold-italic sans-serif Unicode. - **to_monospace(text: str) -> str**: Converts text to monospace Unicode. - **apply_style(text: str, style: str) -> str**: Dynamically applies a specified style ('bold', 'italic', 'bold_italic', 'monospace'). ### Request Example ```python from md2linkedin import ( to_sans_bold, to_sans_italic, to_sans_bold_italic, to_monospace, apply_style, ) print(to_sans_bold("Open to Work")) # Output: 𝗢𝗽𝗲𝗻 𝘁𝗼 𝗪𝗼𝗿𝗸 print(to_sans_italic("3 years of exp")) # Output: 3 𝘺𝘦𝘢𝘳𝘴 𝘰𝘧 𝘦𝘹𝘱 print(to_sans_bold_italic("Key insight")) # Output: 𝙆𝙚𝙮 𝙞𝙣𝙨𝙞𝙜𝙝𝙩 print(to_monospace("print('hi')")) # Output: 𝚙𝚛𝚒𝚗𝚝('𝚑𝚒') print(apply_style("Hiring!", "bold")) # Output: 𝗛𝗶𝗿𝗶𝗻𝗴! ``` ``` -------------------------------- ### Handling Nested Formatting and Code Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Demonstrates how md2linkedin handles nested Markdown formatting and code blocks, including options to disable monospace rendering for code. ```APIDOC ## Handling Nested Formatting and Code ### Description Explains the behavior of `md2linkedin` with nested Markdown elements and provides control over code block rendering. ### Nested Formatting `md2linkedin` processes nested formatting correctly, prioritizing combined styles like bold-italic. ### Code Rendering By default, inline code and fenced code blocks are converted to Unicode Monospace. This behavior can be disabled using the `monospace_code` parameter. ### Request Example ```python from md2linkedin import convert # Nested formatting example result_nested = convert("***very important***") print(result_nested) # Output: 𝙗𝙤𝙡𝙙-𝙞𝙩𝙖𝙡𝙞𝙘 Unicode result_nested_inner = convert("**bold and *italic* inside**") print(result_nested_inner) # Output: **bold and *italic* inside** (rendered with bold wrapping italic) # Code rendering examples result_code_default = convert("Use `**bold**` in Markdown") print(result_code_default) # Output: Use **𝚋𝚘𝚕𝚍** in Markdown result_fenced_code_default = convert("```\nprint('hi')\n```") print(result_fenced_code_default) # Output: 𝚙𝚛𝚒𝚗𝚝('𝚑𝚒') # Disabling monospace for code result_code_plain = convert("`code`", monospace_code=False) print(result_code_plain) # Output: `code` result_fenced_code_plain = convert("```\n**not bold**\n```", monospace_code=False) print(result_fenced_code_plain) # Output: ```\n**not bold**\n``` ``` ``` -------------------------------- ### Unicode Conversion Utilities Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Direct utility functions to convert text to specific Unicode styles. ```APIDOC ## to_sans_bold(text) ### Description Converts ASCII letters and digits to Unicode Mathematical Sans-Serif Bold characters. ## to_sans_italic(text) ### Description Converts ASCII letters to Unicode Mathematical Sans-Serif Italic characters. ## to_sans_bold_italic(text) ### Description Converts ASCII letters to Unicode Mathematical Sans-Serif Bold Italic characters. ``` -------------------------------- ### Pipe Markdown to md2linkedin CLI Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/README.md Pipe Markdown content directly to the `md2linkedin` CLI for conversion. This is useful for converting short snippets or dynamic content. ```bash # Pipe from stdin echo "**Hello**, *world*!" | md2linkedin ``` -------------------------------- ### Unicode Mapping and Text Styling Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/reference/converter.md These endpoints provide functionalities for applying specific text styles and handling unicode mappings. ```APIDOC ## POST /apply_style ### Description Applies a specified style to the given text. ### Method POST ### Endpoint /apply_style ### Request Body - **text** (string) - Required - The input text. - **style** (string) - Required - The style to apply (e.g., 'monospace', 'sans_bold', 'sans_italic', 'sans_bold_italic'). ### Request Example { "text": "Example Text", "style": "monospace" } ### Response #### Success Response (200) - **styled_text** (string) - The text with the applied style. #### Response Example { "styled_text": "Example Text" } ## POST /to_monospace ### Description Converts the input text to monospace font. ### Method POST ### Endpoint /to_monospace ### Request Body - **text** (string) - Required - The input text. ### Request Example { "text": "Example Text" } ### Response #### Success Response (200) - **monospace_text** (string) - The text in monospace font. #### Response Example { "monospace_text": "Example Text" } ## POST /to_sans_bold ### Description Converts the input text to sans-serif bold font. ### Method POST ### Endpoint /to_sans_bold ### Request Body - **text** (string) - Required - The input text. ### Request Example { "text": "Example Text" } ### Response #### Success Response (200) - **sans_bold_text** (string) - The text in sans-serif bold font. #### Response Example { "sans_bold_text": "Example Text" } ## POST /to_sans_italic ### Description Converts the input text to sans-serif italic font. ### Method POST ### Endpoint /to_sans_italic ### Request Body - **text** (string) - Required - The input text. ### Request Example { "text": "Example Text" } ### Response #### Success Response (200) - **sans_italic_text** (string) - The text in sans-serif italic font. #### Response Example { "sans_italic_text": "Example Text" } ## POST /to_sans_bold_italic ### Description Converts the input text to sans-serif bold italic font. ### Method POST ### Endpoint /to_sans_bold_italic ### Request Body - **text** (string) - Required - The input text. ### Request Example { "text": "Example Text" } ### Response #### Success Response (200) - **sans_bold_italic_text** (string) - The text in sans-serif bold italic font. #### Response Example { "sans_bold_italic_text": "Example Text" } ``` -------------------------------- ### Manage Orphaned Markers Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md The library ignores unmatched Markdown markers to prevent processing errors. ```python convert("price: $10 * 3") # → price: $10 * 3 (no crash) convert("under_score alone") # → unchanged ``` -------------------------------- ### to_monospace() Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts ASCII letters and digits to Unicode Mathematical Monospace characters, ideal for code snippets. ```APIDOC ## to_monospace(text) ### Description Converts ASCII letters and digits to Unicode Mathematical Monospace characters. ### Parameters #### Request Body - **text** (string) - Required - The input string to convert to monospace. ``` -------------------------------- ### Convert Text to Bold Unicode Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts ASCII letters and digits to Unicode Mathematical Sans-Serif Bold characters. ```python from md2linkedin import to_sans_bold # Basic text result = to_sans_bold("Hello, World! 123") print(result) # Output: 𝗛𝗲𝗹𝗹𝗼, 𝗪𝗼𝗿𝗹𝗱! 𝟭𝟮𝟯 # Non-ASCII characters pass through unchanged result = to_sans_bold("café") print(result) # Output: 𝗰𝗮𝗳é # LinkedIn profile headline result = to_sans_bold("Open to Work") print(result) # Output: 𝗢𝗽𝗲𝗻 𝘁𝗼 𝗪𝗼𝗿𝗸 ``` -------------------------------- ### Convert Markdown File to LinkedIn Text using CLI Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/README.md Use the `md2linkedin` command-line tool to convert a Markdown file to a LinkedIn-compatible text file. You can specify the input file and an optional output file path. ```bash # Convert a Markdown file (output: post.linkedin.txt) md2linkedin post.md ``` ```bash # Specify output path md2linkedin post.md -o linkedin_post.txt ``` -------------------------------- ### Convert Markdown to LinkedIn Text Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/reference/converter.md These endpoints handle the conversion of markdown content into a format suitable for LinkedIn. ```APIDOC ## POST /convert ### Description Converts a given markdown string into a LinkedIn-compatible text format. ### Method POST ### Endpoint /convert ### Request Body - **markdown_text** (string) - Required - The markdown content to convert. ### Request Example { "markdown_text": "# Hello World\nThis is a **bold** text." } ### Response #### Success Response (200) - **linkedin_text** (string) - The converted LinkedIn-compatible text. #### Response Example { "linkedin_text": "

Hello World

This is a bold text.

" } ## POST /convert_file ### Description Converts the content of a markdown file into a LinkedIn-compatible text format. ### Method POST ### Endpoint /convert_file ### Parameters #### Path Parameters - **file** (file) - Required - The markdown file to upload and convert. ### Response #### Success Response (200) - **linkedin_text** (string) - The converted LinkedIn-compatible text. #### Response Example { "linkedin_text": "

File Content

This is the content from the file.

" } ``` -------------------------------- ### Handling Edge Cases Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Details how md2linkedin manages edge cases such as underscore usage, unmatched markers, large documents, and non-ASCII characters. ```APIDOC ## Handling Edge Cases ### Description Covers specific scenarios like underscore vs. snake_case, unmatched Markdown syntax, performance with large inputs, and character encoding. ### Underscore Italic vs. Snake Case Single underscores are treated as italic markers only when they appear at word boundaries. They are ignored within words (e.g., snake_case). ### Unmatched / Orphaned Markers Unmatched asterisks or underscores are left as-is without causing errors. ### Large Documents The `convert()` function is optimized for performance and memory usage, scaling linearly with input size and suitable for large files. ### Emojis and Non-ASCII Characters Emojis and accented characters are passed through unchanged. ### Request Example ```python from md2linkedin import convert # Underscore handling result_italic = convert("_italic_") print(result_italic) # Output: 𝘪𝘵𝘢𝘭𝘪𝘤 Unicode result_snake = convert("snake_case_variable") print(result_snake) # Output: snake_case_variable # Unmatched markers result_unmatched_star = convert("price: $10 * 3") print(result_unmatched_star) # Output: price: $10 * 3 result_unmatched_underscore = convert("under_score alone") print(result_unmatched_underscore) # Output: under_score alone # Large document example (conceptual) # big_md = Path("quarterly_report.md").read_text() # result_large = convert(big_md) # Emojis and non-ASCII result_emoji = convert("**Excited to share** 🎉 *check this out*!") print(result_emoji) # Output: 𝗘𝘅𝗰𝗶𝘁𝗲𝗱 𝘁𝗼 𝘀𝗵𝗮𝗿𝗲 🎉 𝘤𝘩𝘦𝘤𝘬 𝘵𝘩𝘪𝘴 𝘰𝘶𝘵! ``` ``` -------------------------------- ### Process Large Documents Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md The convert function is optimized for performance and can handle large input strings. ```python big_md = Path("quarterly_report.md").read_text() result = convert(big_md) ``` -------------------------------- ### Convert Text to Bold Italic Unicode Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts ASCII letters to Unicode Mathematical Sans-Serif Bold Italic characters. ```python from md2linkedin import to_sans_bold_italic ``` -------------------------------- ### Preserve Links with md2linkedin CLI Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/README.md Use the `--preserve-links` flag with the `md2linkedin` CLI to retain hyperlink URLs in the output text. By default, links are stripped to their display text. ```bash # Keep link URLs in the output md2linkedin post.md --preserve-links ``` -------------------------------- ### Disable Monospace Code Rendering with md2linkedin CLI Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/README.md Use the `--no-monospace-code` flag with the `md2linkedin` CLI to prevent code spans and fenced code blocks from being rendered in Unicode Monospace. This preserves the original formatting of code. ```bash # Disable monospace code rendering md2linkedin post.md --no-monospace-code ``` -------------------------------- ### Convert Markdown String to LinkedIn Text Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Use the convert function to transform Markdown strings into LinkedIn-compatible Unicode text, with options to preserve links or disable monospace rendering. ```python from md2linkedin import convert # Basic usage with bold and italic result = convert("**Hello**, *world*!") print(result) # Output: 𝗛𝗲𝗹𝗹𝗼, 𝘸𝘰𝘳𝘭𝘥! # Full LinkedIn post with headers, lists, and formatting 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. """ result = convert(md) print(result) # Output: # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # 𝗘𝗫𝗖𝗜𝗧𝗜𝗡𝗚 𝗡𝗘𝗪𝗦 # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # # I'm thrilled to share that 𝘄𝗲 𝗷𝘂𝘀𝘁 𝗹𝗮𝘂𝗻𝗰𝗵𝗲𝗱 a new product! # # Key highlights: # # • 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲: 𝘴𝘱𝘦𝘦𝘥 is faster than the previous version # • 𝗥𝗲𝗹𝗶𝗮𝗯𝗶𝗹𝗶𝘁𝘆: 𝙯𝙚𝙧𝙤 𝙙𝙤𝙬𝙣𝙩𝙞𝙢𝙚 deployments # • 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿 𝗨𝗫: clean, intuitive API # Preserve link syntax instead of stripping URLs result = convert("[GitHub](https://github.com)", preserve_links=True) print(result) # Output: [GitHub](https://github.com) # Disable monospace code rendering result = convert("Use `**bold**` in Markdown", monospace_code=False) print(result) # Output: Use **bold** in Markdown # Code blocks rendered in monospace (default) result = convert("Use `print('hello')` for output") print(result) # Output: Use 𝚙𝚛𝚒𝚗𝚝('𝚑𝚎𝚕𝚕𝚘') for output # Emojis and non-ASCII pass through unchanged result = convert("**Excited to share** 🎉 *check this out*!") print(result) # Output: 𝗘𝘅𝗰𝗶𝘁𝗲𝗱 𝘁𝗼 𝘀𝗵𝗮𝗿𝗲 🎉 𝘤𝘩𝘦𝘤𝘬 𝘵𝘩𝘪𝘴 𝘰𝘶𝘵! ``` -------------------------------- ### Convert text to monospace Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts ASCII characters to Unicode Mathematical Monospace characters, suitable for code snippets. ```python from md2linkedin import to_monospace # Basic text result = to_monospace("Hello, World! 123") print(result) # Output: 𝙷𝚎𝚕𝚕𝚘, 𝚆𝚘𝚛𝚕𝚍! 𝟷𝟸𝟹 # Code snippet result = to_monospace("print('hi')") print(result) # Output: 𝚙𝚛𝚒𝚗𝚝('𝚑𝚒') # Function name result = to_monospace("async def main()") print(result) # Output: 𝚊𝚜𝚢𝚗𝚌 𝚍𝚎𝚏 𝚖𝚊𝚒𝚗() ``` -------------------------------- ### Handle Emojis and Non-ASCII Characters Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Emojis and accented characters remain unaffected by the Unicode remapping process. ```python from md2linkedin import convert result = convert("**Excited to share** 🎉 *check this out*!") print(result) # 𝗘𝘅𝗰𝗶𝘁𝗲𝗱 𝘁𝗼 𝘀𝗵𝗮𝗿𝗲 🎉 𝘤𝘩𝘦𝘤𝘬 𝘵𝘩𝘪𝘴 𝘰𝘶𝘵! ``` -------------------------------- ### Convert Text to Italic Unicode Source: https://context7.com/indrajeetpatil/md2linkedin/llms.txt Converts ASCII letters to Unicode Mathematical Sans-Serif Italic characters, leaving digits unchanged. ```python from md2linkedin import to_sans_italic # Basic text (note: digits are not italicized) result = to_sans_italic("Hello, World!") print(result) # Output: 𝘏𝘦𝘭𝘭𝘰, 𝘞𝘰𝘳𝘭𝘥! # Text with numbers result = to_sans_italic("price: $42") print(result) # Output: 𝘱𝘳𝘪𝘤𝘦: $42 # Experience highlight result = to_sans_italic("3 years of experience") print(result) # Output: 3 𝘺𝘦𝘢𝘳𝘴 𝘰𝘧 𝘦𝘹𝘱𝘦𝘳𝘪𝘦𝘯𝘤𝘦 ``` -------------------------------- ### Handle Underscore Italicization Source: https://github.com/indrajeetpatil/md2linkedin/blob/main/docs/advanced.md Single underscores are only treated as italics when placed at word boundaries. ```python convert("_italic_") # → italic Unicode convert("snake_case_variable") # → unchanged ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.