smartypants library
The smartypants library.
Provides SmartyPants.formatText for converting plain text into typographically correct output. Supports smart quotes, en/em dashes, ellipsis, math symbols, arrows, and CJK-specific transformations.
final result = SmartyPants.formatText('"Hello" -- world!');
// result == '"Hello" – world!'
Classes
- SmartyPants
- Applies SmartyPants-style typography transformations to a string.
- SmartyPantsConfig
- Configuration for SmartyPants.formatText transformations.
- Token
- A single unit produced by tokenize, representing either a span of plain text or an HTML tag/element.
Enums
- SmartyPantsLocale
- Supported locale presets for typography transformations.
- TokenType
- The type of a Token: either raw text or an HTML tag/element.
Functions
-
convertCjkAngleBrackets(
String input, {String doubleAngleMarker = '<<', String? markerEscape}) → String - Converts double and single angle brackets to CJK quotation marks.
-
isCjkCharacter(
int codeUnit) → bool -
Returns
trueifcodeUnitfalls within a CJK character range. -
isCjkPunctuation(
int codeUnit) → bool -
Returns
trueifcodeUnitis a CJK punctuation character. -
normalizeCjkEllipsis(
String input) → String - Normalizes CJK-style ellipsis patterns to the Unicode ellipsis character.
-
tokenize(
String input) → List< Token> -
Splits
inputinto a list of Tokens, alternating between plain-text spans and HTML tags/elements.