33Features:
44
55- splitting text into lines, words, and chars
6- - support for CJT languages (Traditional/Simplified Chinese, Japanese, Korean, etc )
6+ - support for CJT languages (Traditional/Simplified Chinese, Japanese, Korean, Thai )
77- nested HTML elements (with all the types of splits)
88- text balancing
99- accessibility
@@ -25,6 +25,20 @@ import SplitText from '@activetheory/split-text';
2525const el = document .querySelector (' .el' );
2626
2727const splitTextInstance = new SplitText (el);
28+
29+ console .log (splitTextInstance .lines );
30+ console .log (splitTextInstance .words );
31+ console .log (splitTextInstance .chars );
32+
33+ // Useful for animations purposes
34+ for (const line of splitTextInstance .lines ) {
35+ console .log (line .__words );
36+ console .log (line .__wordCount );
37+ }
38+
39+ for (const word of splitTextInstance .words ) {
40+ console .log (word .__lineIndex );
41+ }
2842```
2943
3044## Options
@@ -61,4 +75,6 @@ To run the demo, run `npm run dev`.
6175### CJT locales
6276
6377The ` handleCJT ` option will leverage ` ​ ` to split the text properly.
78+ This library does not handle this automatically, you need to manually add ` ​ ` in your text.
79+ However, it's not mandatory, you can still use the library without it and most of the time it will work nicely.
6480We suggest to have a look at https://github.com/google/budoux/ for more information about how to place ` ​ ` in your text.
0 commit comments