Transforms markdown into TTS-friendly text with math and language handling.
// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import type { Nodes, PhrasingContent, Root, RootContent } from 'mdast'
import type { Plugin } from 'unified'
import type { SpeechPreprocessor } from './preprocessor'
import remarkMath from 'remark-math'
import remarkParse from 'remark-parse'
import { unified } from 'unified'
import { detectSpeechLanguage, toSpeechLanguage } from './language'
import { normalizeMathDelimiters } from './markdown'
import { mathSpeechPreprocessor, moneySpeechPreprocessor } from './preprocessor'
export interface SpeechTextOptions {
/**
* One character that the output keeps as often as the source has it, also inside unspoken nodes.
* The speec
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key