# [API Reference](<#api-reference>)

## [High-level API](<#high-level-api>)

Convert Markdown text to LinkedIn-compatible Unicode plain text.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The Markdown source string. | *required* |
| `preserve_links` | `bool` | When `True`, link syntax (`[text](url)`) is left unchanged in the output instead of being reduced to display text. | `False` |
| `monospace_code` | `bool` | When `True` (the default), inline code spans and fenced code blocks are rendered in Unicode Mathematical Monospace. When `False`, code is kept as plain text, with the backticks and fences stripped. | `True` |

Returns:

| Type | Description |
| --- | --- |
| `str` | A plain-text string suitable for pasting into LinkedIn. |

Convert a Markdown file and write the result to a `.txt` file.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `input_path` | `str \| Path` | Path to the Markdown source file. | *required* |
| `output_path` | `str \| Path \| None` | Destination path for the converted output. Defaults to *input\_path* with its last suffix replaced by `.linkedin.txt`, so `notes.v2.md` is written to `notes.v2.linkedin.txt`. | `None` |
| `preserve_links` | `bool` | Passed through to :func:`convert`. | `False` |
| `monospace_code` | `bool` | Passed through to :func:`convert`. | `True` |

Returns:

| Type | Description |
| --- | --- |
| `Path` | The path of the written output file. |

Raises:

| Type | Description |
| --- | --- |
| `FileNotFoundError` | If *input\_path* does not exist. |

## [Unicode Mapping](<#unicode-mapping>)

Apply a Unicode sans-serif style to text.

A convenience dispatcher that routes to the appropriate mapping function based on the requested style. Useful when the style is determined dynamically at runtime.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The input string to convert. | *required* |
| `style` | `Literal['bold', 'italic', 'bold_italic']` | One of `"bold"`, `"italic"`, or `"bold_italic"`. | *required* |

Returns:

| Type | Description |
| --- | --- |
| `str` | A new string with the requested Unicode style applied. |

Raises:

| Type | Description |
| --- | --- |
| `ValueError` | If *style* is not one of the three accepted values. |

Examples:

```pycon
>>> apply_style("hello", "bold")
'𝗵𝗲𝗹𝗹𝗼'
```

```pycon
>>> apply_style("hello", "italic")
'𝘩𝘦𝘭𝘭𝘰'
```

```pycon
>>> apply_style("hello", "bold_italic")
'𝙝𝙚𝙡𝙡𝙤'
```

Convert text to Unicode Mathematical Monospace.

ASCII uppercase letters, lowercase letters, and digits are mapped to their monospace counterparts. All other characters (spaces, punctuation, non-ASCII) pass through unchanged.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The input string to convert. | *required* |

Returns:

| Type | Description |
| --- | --- |
| `str` | A new string with ASCII alphanumerics replaced by monospace |
| `str` | Unicode equivalents. |

Examples:

```pycon
>>> to_monospace("Hello, World! 123")
'𝙷𝚎𝚕𝚕𝚘, 𝚆𝚘𝚛𝚕𝚍! 𝟷𝟸𝟹'
```

```pycon
>>> to_monospace("café")
'𝚌𝚊𝚏é'
```

```pycon
>>> to_monospace("")
''
```

Convert text to Unicode Mathematical Sans-Serif Bold.

ASCII uppercase letters, lowercase letters, and digits are mapped to their bold sans-serif counterparts. All other characters (spaces, punctuation, non-ASCII) pass through unchanged.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The input string to convert. | *required* |

Returns:

| Type | Description |
| --- | --- |
| `str` | A new string with ASCII alphanumerics replaced by bold sans-serif |
| `str` | Unicode equivalents. |

Examples:

```pycon
>>> to_sans_bold("Hello, World! 123")
'𝗛𝗲𝗹𝗹𝗼, 𝗪𝗼𝗿𝗹𝗱! 𝟭𝟮𝟯'
```

```pycon
>>> to_sans_bold("café")
'𝗰𝗮𝗳é'
```

```pycon
>>> to_sans_bold("")
''
```

Convert text to Unicode Mathematical Sans-Serif Italic.

ASCII uppercase and lowercase letters are mapped to their italic sans-serif counterparts. Digits and all other characters pass through unchanged (there are no italic digit codepoints in this Unicode block).

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The input string to convert. | *required* |

Returns:

| Type | Description |
| --- | --- |
| `str` | A new string with ASCII letters replaced by italic sans-serif |
| `str` | Unicode equivalents. |

Examples:

```pycon
>>> to_sans_italic("Hello, World!")
'𝘏𝘦𝘭𝘭𝘰, 𝘞𝘰𝘳𝘭𝘥!'
```

```pycon
>>> to_sans_italic("price: $42")
'𝘱𝘳𝘪𝘤𝘦: $42'
```

```pycon
>>> to_sans_italic("")
''
```

Convert text to Unicode Mathematical Sans-Serif Bold Italic.

ASCII uppercase and lowercase letters are mapped to their bold-italic sans-serif counterparts. Digits and all other characters pass through unchanged.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `text` | `str` | The input string to convert. | *required* |

Returns:

| Type | Description |
| --- | --- |
| `str` | A new string with ASCII letters replaced by bold-italic sans-serif |
| `str` | Unicode equivalents. |

Examples:

```pycon
>>> to_sans_bold_italic("Hello, World!")
'𝙃𝙚𝙡𝙡𝙤, 𝙒𝙤𝙧𝙡𝙙!'
```

```pycon
>>> to_sans_bold_italic("")
''
```
