Skip to content

Commit

Permalink
Add notes on Web Components (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushuhei authored Nov 28, 2024
1 parent 35b205a commit 82621e6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ import 'budoux/module/webcomponents/budoux-zh-hant';
import 'budoux/module/webcomponents/budoux-th';
```

**Note:** BudouX Web Components directly manipulate the input HTML content
instead of outputting the result to a shadow DOM. This design was chosen because
the goal of BudouX Web Components is to simply insert zero-width spaces (ZWSPs)
into the content, and isolating the style from the rest of the document could
introduce unexpected side effects for developers.

Consequently, cloning or editing the element might lead to duplicated ZWSPs
between phrases. This is because BudouX Web Components cannot distinguish
between characters that originate in the source and those that are inserted by
BudouX itself once connected to the document. Duplicating ZWSPs will not cause
any severe problems in controlling line breaks, and they are invisible anyway,
but this is the reason we do not support other separator characters for these
components.

### CLI

You can also format inputs on your terminal with `budoux` command.
Expand Down

0 comments on commit 82621e6

Please # to comment.