@drghaliasri/butex 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/index.global.js +8 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react-document2.d.mts +1 -1
- package/dist/react-document2.d.ts +1 -1
- package/dist/react-document2.js +24 -43
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +24 -43
- package/dist/react-document2.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,6 +118,30 @@ Use this when you only need to render LaTeX strings:
|
|
|
118
118
|
|
|
119
119
|
This mode does not require the GUI editor runtime.
|
|
120
120
|
|
|
121
|
+
### Host CSS resets (Tailwind Preflight and similar)
|
|
122
|
+
|
|
123
|
+
MathJax renders SVG equations as inline `<svg>` elements, and MathJax 4's inline
|
|
124
|
+
line-breaking can emit one equation as **several sibling `<svg>` chunks**. Global
|
|
125
|
+
CSS resets that declare `svg { display: block }` (e.g. **Tailwind Preflight**)
|
|
126
|
+
stack those chunks vertically, so equations render one term per line.
|
|
127
|
+
|
|
128
|
+
BuTeX's injected styles guard against this with:
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
mjx-container svg {
|
|
132
|
+
display: inline;
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The guard ships in both `injectBuTeXStyles()` (`BUTEX_CHROME_CSS`) and
|
|
137
|
+
`injectBuTeXDocument2Styles()` (`DOCUMENT2_WIDGET_CSS`), so make sure the host
|
|
138
|
+
calls at least one of them (or embeds the CSS constants). If your app injects
|
|
139
|
+
neither and you see stacked/wrapped equations under Tailwind, add the rule above
|
|
140
|
+
to your global stylesheet after the reset.
|
|
141
|
+
|
|
142
|
+
Also pin the MathJax version the host loads (e.g. `mathjax@4.1`) instead of a
|
|
143
|
+
floating major tag, so CDN updates cannot change rendering behavior silently.
|
|
144
|
+
|
|
121
145
|
### 2) GUI editor contract (shippable editor UX)
|
|
122
146
|
|
|
123
147
|
Use this when you want the same editor UX as the demo:
|
package/dist/index.global.js
CHANGED
|
@@ -101,6 +101,14 @@ ${BUTEX_TAKWEEN_FONT_FACE_CSS}
|
|
|
101
101
|
var BUTEX_CHROME_CSS = `
|
|
102
102
|
${BUTEX_FONT_FACE_CSS}
|
|
103
103
|
|
|
104
|
+
/* Guard against host CSS resets (e.g. Tailwind Preflight's \`svg { display: block }\`).
|
|
105
|
+
* MathJax relies on the browser default \`display: inline\` for its SVG output; with
|
|
106
|
+
* MathJax v4 inline line-breaking an equation can be emitted as several sibling
|
|
107
|
+
* <svg> chunks, and a block-level reset stacks them vertically. */
|
|
108
|
+
mjx-container svg {
|
|
109
|
+
display: inline;
|
|
110
|
+
}
|
|
111
|
+
|
|
104
112
|
/* BuTeX: Arabic sqrt \u2014 outer mirror entire radical, inner unmirror index & radicand */
|
|
105
113
|
mjx-container[jax="CHTML"] .mjx-rtl-mirror {
|
|
106
114
|
transform: scaleX(-1);
|