katex-spec.js.snap 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  1. // Jest Snapshot v1, https://goo.gl/fbAQLP
  2. exports[`A begin/end parser should grab \\arraystretch 1`] = `
  3. [
  4. {
  5. "type": "array",
  6. "arraystretch": 1.5,
  7. "body": [
  8. [
  9. {
  10. "type": "styling",
  11. "body": [
  12. {
  13. "type": "ordgroup",
  14. "body": [
  15. {
  16. "type": "mathord",
  17. "loc": {
  18. "end": 37,
  19. "lexer": {
  20. "input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
  21. "lastIndex": 56
  22. },
  23. "start": 36
  24. },
  25. "mode": "math",
  26. "text": "a"
  27. }
  28. ],
  29. "mode": "math"
  30. }
  31. ],
  32. "mode": "math",
  33. "style": "text"
  34. },
  35. {
  36. "type": "styling",
  37. "body": [
  38. {
  39. "type": "ordgroup",
  40. "body": [
  41. {
  42. "type": "mathord",
  43. "loc": {
  44. "end": 39,
  45. "lexer": {
  46. "input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
  47. "lastIndex": 56
  48. },
  49. "start": 38
  50. },
  51. "mode": "math",
  52. "text": "b"
  53. }
  54. ],
  55. "mode": "math"
  56. }
  57. ],
  58. "mode": "math",
  59. "style": "text"
  60. }
  61. ],
  62. [
  63. {
  64. "type": "styling",
  65. "body": [
  66. {
  67. "type": "ordgroup",
  68. "body": [
  69. {
  70. "type": "mathord",
  71. "loc": {
  72. "end": 42,
  73. "lexer": {
  74. "input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
  75. "lastIndex": 56
  76. },
  77. "start": 41
  78. },
  79. "mode": "math",
  80. "text": "c"
  81. }
  82. ],
  83. "mode": "math"
  84. }
  85. ],
  86. "mode": "math",
  87. "style": "text"
  88. },
  89. {
  90. "type": "styling",
  91. "body": [
  92. {
  93. "type": "ordgroup",
  94. "body": [
  95. {
  96. "type": "mathord",
  97. "loc": {
  98. "end": 44,
  99. "lexer": {
  100. "input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
  101. "lastIndex": 56
  102. },
  103. "start": 43
  104. },
  105. "mode": "math",
  106. "text": "d"
  107. }
  108. ],
  109. "mode": "math"
  110. }
  111. ],
  112. "mode": "math",
  113. "style": "text"
  114. }
  115. ]
  116. ],
  117. "hLinesBeforeRow": [
  118. [
  119. ],
  120. [
  121. ],
  122. [
  123. ]
  124. ],
  125. "hskipBeforeAndAfter": false,
  126. "mode": "math",
  127. "rowGaps": [
  128. null
  129. ]
  130. }
  131. ]
  132. `;
  133. exports[`A font parser \\boldsymbol should inherit mbin/mrel from argument 1`] = `
  134. [
  135. {
  136. "classes": [
  137. "mord",
  138. "mathdefault"
  139. ],
  140. "depth": 0,
  141. "height": 0.43056,
  142. "italic": 0,
  143. "maxFontSize": 1,
  144. "skew": 0,
  145. "style": {
  146. },
  147. "text": "a",
  148. "width": 0.52859
  149. },
  150. {
  151. "attributes": {
  152. },
  153. "children": [
  154. {
  155. "attributes": {
  156. },
  157. "children": [
  158. ],
  159. "classes": [
  160. "mord"
  161. ],
  162. "depth": 0,
  163. "height": 0,
  164. "maxFontSize": 0,
  165. "style": {
  166. }
  167. }
  168. ],
  169. "classes": [
  170. "mord"
  171. ],
  172. "depth": 0,
  173. "height": 0,
  174. "maxFontSize": 0,
  175. "style": {
  176. }
  177. },
  178. {
  179. "classes": [
  180. "mord",
  181. "mathdefault"
  182. ],
  183. "depth": 0,
  184. "height": 0.69444,
  185. "italic": 0,
  186. "maxFontSize": 1,
  187. "skew": 0,
  188. "style": {
  189. },
  190. "text": "b",
  191. "width": 0.42917
  192. },
  193. {
  194. "attributes": {
  195. },
  196. "children": [
  197. ],
  198. "classes": [
  199. "mspace"
  200. ],
  201. "depth": 0,
  202. "height": 0,
  203. "maxFontSize": 0,
  204. "style": {
  205. "marginRight": "0.2777777777777778em"
  206. }
  207. },
  208. {
  209. "attributes": {
  210. },
  211. "children": [
  212. {
  213. "attributes": {
  214. },
  215. "children": [
  216. {
  217. "classes": [
  218. "mrel",
  219. "mathbf"
  220. ],
  221. "depth": -0.10889,
  222. "height": 0.39111,
  223. "italic": 0,
  224. "maxFontSize": 1,
  225. "skew": 0,
  226. "style": {
  227. },
  228. "text": "=",
  229. "width": 0.89444
  230. }
  231. ],
  232. "classes": [
  233. "mord"
  234. ],
  235. "depth": 0,
  236. "height": 0.39111,
  237. "maxFontSize": 1,
  238. "style": {
  239. }
  240. }
  241. ],
  242. "classes": [
  243. "mrel"
  244. ],
  245. "depth": 0,
  246. "height": 0.39111,
  247. "maxFontSize": 1,
  248. "style": {
  249. }
  250. },
  251. {
  252. "attributes": {
  253. },
  254. "children": [
  255. ],
  256. "classes": [
  257. "mspace"
  258. ],
  259. "depth": 0,
  260. "height": 0,
  261. "maxFontSize": 0,
  262. "style": {
  263. "marginRight": "0.2777777777777778em"
  264. }
  265. },
  266. {
  267. "classes": [
  268. "mord",
  269. "mathdefault"
  270. ],
  271. "depth": 0,
  272. "height": 0.43056,
  273. "italic": 0,
  274. "maxFontSize": 1,
  275. "skew": 0.05556,
  276. "style": {
  277. },
  278. "text": "c",
  279. "width": 0.43276
  280. },
  281. {
  282. "attributes": {
  283. },
  284. "children": [
  285. ],
  286. "classes": [
  287. "mspace"
  288. ],
  289. "depth": 0,
  290. "height": 0,
  291. "maxFontSize": 0,
  292. "style": {
  293. "marginRight": "0.2222222222222222em"
  294. }
  295. },
  296. {
  297. "attributes": {
  298. },
  299. "children": [
  300. {
  301. "attributes": {
  302. },
  303. "children": [
  304. {
  305. "classes": [
  306. "mord",
  307. "mathbf"
  308. ],
  309. "depth": 0.13333,
  310. "height": 0.63333,
  311. "italic": 0,
  312. "maxFontSize": 1,
  313. "skew": 0,
  314. "style": {
  315. },
  316. "text": "+",
  317. "width": 0.89444
  318. }
  319. ],
  320. "classes": [
  321. "mord"
  322. ],
  323. "depth": 0.13333,
  324. "height": 0.63333,
  325. "maxFontSize": 1,
  326. "style": {
  327. }
  328. }
  329. ],
  330. "classes": [
  331. "mbin"
  332. ],
  333. "depth": 0.13333,
  334. "height": 0.63333,
  335. "maxFontSize": 1,
  336. "style": {
  337. }
  338. },
  339. {
  340. "attributes": {
  341. },
  342. "children": [
  343. ],
  344. "classes": [
  345. "mspace"
  346. ],
  347. "depth": 0,
  348. "height": 0,
  349. "maxFontSize": 0,
  350. "style": {
  351. "marginRight": "0.2222222222222222em"
  352. }
  353. },
  354. {
  355. "classes": [
  356. "mord",
  357. "mathdefault"
  358. ],
  359. "depth": 0,
  360. "height": 0.69444,
  361. "italic": 0,
  362. "maxFontSize": 1,
  363. "skew": 0.16667,
  364. "style": {
  365. },
  366. "text": "d",
  367. "width": 0.52049
  368. },
  369. {
  370. "attributes": {
  371. },
  372. "children": [
  373. ],
  374. "classes": [
  375. "mspace"
  376. ],
  377. "depth": 0,
  378. "height": 0,
  379. "maxFontSize": 0,
  380. "style": {
  381. "marginRight": "0.2222222222222222em"
  382. }
  383. },
  384. {
  385. "attributes": {
  386. },
  387. "children": [
  388. {
  389. "attributes": {
  390. },
  391. "children": [
  392. {
  393. "classes": [
  394. "mord",
  395. "mathbf"
  396. ],
  397. "depth": 0.13333,
  398. "height": 0.63333,
  399. "italic": 0,
  400. "maxFontSize": 1,
  401. "skew": 0,
  402. "style": {
  403. },
  404. "text": "+",
  405. "width": 0.89444
  406. },
  407. {
  408. "classes": [
  409. "mord",
  410. "mathbf"
  411. ],
  412. "depth": 0.13333,
  413. "height": 0.63333,
  414. "italic": 0,
  415. "maxFontSize": 1,
  416. "skew": 0,
  417. "style": {
  418. },
  419. "text": "+",
  420. "width": 0.89444
  421. }
  422. ],
  423. "classes": [
  424. "mord"
  425. ],
  426. "depth": 0.13333,
  427. "height": 0.63333,
  428. "maxFontSize": 1,
  429. "style": {
  430. }
  431. }
  432. ],
  433. "classes": [
  434. "mbin"
  435. ],
  436. "depth": 0.13333,
  437. "height": 0.63333,
  438. "maxFontSize": 1,
  439. "style": {
  440. }
  441. },
  442. {
  443. "attributes": {
  444. },
  445. "children": [
  446. ],
  447. "classes": [
  448. "mspace"
  449. ],
  450. "depth": 0,
  451. "height": 0,
  452. "maxFontSize": 0,
  453. "style": {
  454. "marginRight": "0.2222222222222222em"
  455. }
  456. },
  457. {
  458. "classes": [
  459. "mord",
  460. "mathdefault"
  461. ],
  462. "depth": 0,
  463. "height": 0.43056,
  464. "italic": 0,
  465. "maxFontSize": 1,
  466. "skew": 0.05556,
  467. "style": {
  468. },
  469. "text": "e",
  470. "width": 0.46563
  471. },
  472. {
  473. "attributes": {
  474. },
  475. "children": [
  476. {
  477. "attributes": {
  478. },
  479. "children": [
  480. {
  481. "classes": [
  482. "mord",
  483. "boldsymbol"
  484. ],
  485. "depth": 0,
  486. "height": 0.44444,
  487. "italic": 0,
  488. "maxFontSize": 1,
  489. "skew": 0,
  490. "style": {
  491. },
  492. "text": "x",
  493. "width": 0.65903
  494. },
  495. {
  496. "classes": [
  497. "mord",
  498. "boldsymbol"
  499. ],
  500. "depth": 0.19444,
  501. "height": 0.44444,
  502. "italic": 0.03704,
  503. "maxFontSize": 1,
  504. "skew": 0,
  505. "style": {
  506. },
  507. "text": "y",
  508. "width": 0.59028
  509. },
  510. {
  511. "classes": [
  512. "mord",
  513. "boldsymbol"
  514. ],
  515. "depth": 0,
  516. "height": 0.44444,
  517. "italic": 0.04213,
  518. "maxFontSize": 1,
  519. "skew": 0,
  520. "style": {
  521. },
  522. "text": "z",
  523. "width": 0.55509
  524. }
  525. ],
  526. "classes": [
  527. "mord"
  528. ],
  529. "depth": 0.19444,
  530. "height": 0.44444,
  531. "maxFontSize": 1,
  532. "style": {
  533. }
  534. }
  535. ],
  536. "classes": [
  537. "mord"
  538. ],
  539. "depth": 0.19444,
  540. "height": 0.44444,
  541. "maxFontSize": 1,
  542. "style": {
  543. }
  544. },
  545. {
  546. "classes": [
  547. "mord",
  548. "mathdefault"
  549. ],
  550. "depth": 0.19444,
  551. "height": 0.69444,
  552. "italic": 0.10764,
  553. "maxFontSize": 1,
  554. "skew": 0.16667,
  555. "style": {
  556. },
  557. "text": "f",
  558. "width": 0.48959
  559. }
  560. ]
  561. `;
  562. exports[`A parse tree generator generates a tree 1`] = `
  563. [
  564. {
  565. "type": "supsub",
  566. "base": {
  567. "type": "mathord",
  568. "mode": "math",
  569. "text": "\\\\sigma"
  570. },
  571. "mode": "math",
  572. "sup": {
  573. "type": "textord",
  574. "mode": "math",
  575. "text": "2"
  576. }
  577. }
  578. ]
  579. `;
  580. exports[`A parser that does not throw on unsupported commands should build katex-error span for other type of KaTeX error 1`] = `
  581. {
  582. "attributes": {
  583. "style": "color:#933",
  584. "title": "ParseError: KaTeX parse error: Double superscript at position 4: 2^2^̲2"
  585. },
  586. "children": [
  587. {
  588. "classes": [
  589. ],
  590. "depth": 0,
  591. "height": 0,
  592. "italic": 0,
  593. "maxFontSize": 0,
  594. "skew": 0,
  595. "style": {
  596. },
  597. "text": "2^2^2",
  598. "width": 0
  599. }
  600. ],
  601. "classes": [
  602. "katex-error"
  603. ],
  604. "depth": 0,
  605. "height": 0,
  606. "maxFontSize": 0,
  607. "style": {
  608. }
  609. }
  610. `;
  611. exports[`A parser that does not throw on unsupported commands should properly escape LaTeX in errors 1`] = `
  612. <span class="katex-error"
  613. title="ParseError: KaTeX parse error: Expected group after &#x27;^&#x27; at position 2: 2^̲&amp;&quot;&lt;&gt;"
  614. style="color:#933"
  615. >
  616. 2^&amp;&quot;&lt;&gt;
  617. </span>
  618. `;
  619. exports[`An implicit group parser within optional groups should work style commands \\sqrt[\\textstyle 3]{x} 1`] = `
  620. [
  621. {
  622. "type": "sqrt",
  623. "body": {
  624. "type": "ordgroup",
  625. "body": [
  626. {
  627. "type": "mathord",
  628. "mode": "math",
  629. "text": "x"
  630. }
  631. ],
  632. "mode": "math"
  633. },
  634. "index": {
  635. "type": "ordgroup",
  636. "body": [
  637. {
  638. "type": "styling",
  639. "body": [
  640. {
  641. "type": "textord",
  642. "mode": "math",
  643. "text": "3"
  644. }
  645. ],
  646. "mode": "math",
  647. "style": "text"
  648. }
  649. ],
  650. "mode": "math"
  651. },
  652. "mode": "math"
  653. }
  654. ]
  655. `;
  656. exports[`An implicit group parser within optional groups should work with \\color: \\sqrt[\\color{red} 3]{x} 1`] = `
  657. [
  658. {
  659. "type": "sqrt",
  660. "body": {
  661. "type": "ordgroup",
  662. "body": [
  663. {
  664. "type": "mathord",
  665. "mode": "math",
  666. "text": "x"
  667. }
  668. ],
  669. "mode": "math"
  670. },
  671. "index": {
  672. "type": "ordgroup",
  673. "body": [
  674. {
  675. "type": "color",
  676. "body": [
  677. {
  678. "type": "textord",
  679. "mode": "math",
  680. "text": "3"
  681. }
  682. ],
  683. "color": "red",
  684. "mode": "math"
  685. }
  686. ],
  687. "mode": "math"
  688. },
  689. "mode": "math"
  690. }
  691. ]
  692. `;
  693. exports[`An implicit group parser within optional groups should work with old font functions: \\sqrt[\\tt 3]{x} 1`] = `
  694. [
  695. {
  696. "type": "sqrt",
  697. "body": {
  698. "type": "ordgroup",
  699. "body": [
  700. {
  701. "type": "mathord",
  702. "mode": "math",
  703. "text": "x"
  704. }
  705. ],
  706. "mode": "math"
  707. },
  708. "index": {
  709. "type": "ordgroup",
  710. "body": [
  711. {
  712. "type": "font",
  713. "body": {
  714. "type": "ordgroup",
  715. "body": [
  716. {
  717. "type": "textord",
  718. "mode": "math",
  719. "text": "3"
  720. }
  721. ],
  722. "mode": "math"
  723. },
  724. "font": "mathtt",
  725. "mode": "math"
  726. }
  727. ],
  728. "mode": "math"
  729. },
  730. "mode": "math"
  731. }
  732. ]
  733. `;
  734. exports[`An implicit group parser within optional groups should work with sizing commands: \\sqrt[\\small 3]{x} 1`] = `
  735. [
  736. {
  737. "type": "sqrt",
  738. "body": {
  739. "type": "ordgroup",
  740. "body": [
  741. {
  742. "type": "mathord",
  743. "mode": "math",
  744. "text": "x"
  745. }
  746. ],
  747. "mode": "math"
  748. },
  749. "index": {
  750. "type": "ordgroup",
  751. "body": [
  752. {
  753. "type": "sizing",
  754. "body": [
  755. {
  756. "type": "textord",
  757. "mode": "math",
  758. "text": "3"
  759. }
  760. ],
  761. "mode": "math",
  762. "size": 5
  763. }
  764. ],
  765. "mode": "math"
  766. },
  767. "mode": "math"
  768. }
  769. ]
  770. `;
  771. exports[`Extending katex by new fonts and symbols Add new font class to new extended symbols 1`] = `
  772. <span class="katex">
  773. <span class="katex-mathml">
  774. <math>
  775. <semantics>
  776. <mrow>
  777. <mi mathvariant="normal">
  778. ۹
  779. </mi>
  780. <msup>
  781. <mi mathvariant="normal">
  782. ۹
  783. </mi>
  784. <mrow>
  785. <mi mathvariant="normal">
  786. ۱
  787. </mi>
  788. <mi mathvariant="normal">
  789. ۱
  790. </mi>
  791. </mrow>
  792. </msup>
  793. </mrow>
  794. <annotation encoding="application/x-tex">
  795. ۹۹^{۱۱}
  796. </annotation>
  797. </semantics>
  798. </math>
  799. </span>
  800. <span class="katex-html"
  801. aria-hidden="true"
  802. >
  803. <span class="base">
  804. <span class="strut"
  805. style="height:0.84425em;vertical-align:0em;"
  806. >
  807. </span>
  808. <span class="mord mockEasternArabicFont-Regular">
  809. ۹
  810. </span>
  811. <span class="mord">
  812. <span class="mord mockEasternArabicFont-Regular">
  813. ۹
  814. </span>
  815. <span class="msupsub">
  816. <span class="vlist-t">
  817. <span class="vlist-r">
  818. <span class="vlist"
  819. style="height:0.84425em;"
  820. >
  821. <span style="top:-3.063em;margin-right:0.05em;">
  822. <span class="pstrut"
  823. style="height:2.7em;"
  824. >
  825. </span>
  826. <span class="sizing reset-size6 size3 mtight">
  827. <span class="mord mtight">
  828. <span class="mord mockEasternArabicFont-Regular mtight">
  829. ۱
  830. </span>
  831. <span class="mord mockEasternArabicFont-Regular mtight">
  832. ۱
  833. </span>
  834. </span>
  835. </span>
  836. </span>
  837. </span>
  838. </span>
  839. </span>
  840. </span>
  841. </span>
  842. </span>
  843. </span>
  844. </span>
  845. `;
  846. exports[`href and url commands should not affect spacing around 1`] = `
  847. [
  848. {
  849. "classes": [
  850. "mord",
  851. "mathdefault"
  852. ],
  853. "depth": 0,
  854. "height": 0.43056,
  855. "italic": 0,
  856. "maxFontSize": 1,
  857. "skew": 0,
  858. "style": {
  859. },
  860. "text": "a",
  861. "width": 0.52859
  862. },
  863. {
  864. "attributes": {
  865. },
  866. "children": [
  867. ],
  868. "classes": [
  869. "mspace"
  870. ],
  871. "depth": 0,
  872. "height": 0,
  873. "maxFontSize": 0,
  874. "style": {
  875. "marginRight": "0.2222222222222222em"
  876. }
  877. },
  878. {
  879. "attributes": {
  880. "href": "http://example.com/"
  881. },
  882. "children": [
  883. {
  884. "classes": [
  885. "mbin"
  886. ],
  887. "depth": 0.08333,
  888. "height": 0.58333,
  889. "italic": 0,
  890. "maxFontSize": 1,
  891. "skew": 0,
  892. "style": {
  893. },
  894. "text": "+",
  895. "width": 0.77778
  896. },
  897. {
  898. "attributes": {
  899. },
  900. "children": [
  901. ],
  902. "classes": [
  903. "mspace"
  904. ],
  905. "depth": 0,
  906. "height": 0,
  907. "maxFontSize": 0,
  908. "style": {
  909. "marginRight": "0.2222222222222222em"
  910. }
  911. },
  912. {
  913. "classes": [
  914. "mord",
  915. "mathdefault"
  916. ],
  917. "depth": 0,
  918. "height": 0.69444,
  919. "italic": 0,
  920. "maxFontSize": 1,
  921. "skew": 0,
  922. "style": {
  923. },
  924. "text": "b",
  925. "width": 0.42917
  926. }
  927. ],
  928. "classes": [
  929. ],
  930. "depth": 0.08333,
  931. "height": 0.69444,
  932. "maxFontSize": 1,
  933. "style": {
  934. }
  935. }
  936. ]
  937. `;