mathpix-markdown-it 2.0.11 → 2.0.13
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 +40 -6
- package/es5/bundle.js +7 -7
- package/es5/context-menu.js +1 -1
- package/es5/index.js +7 -7
- package/lib/helpers/parse-mmd-element.js +1 -1
- package/lib/helpers/parse-mmd-element.js.map +1 -1
- package/lib/markdown/common/consts.d.ts +2 -0
- package/lib/markdown/common/consts.js +3 -1
- package/lib/markdown/common/consts.js.map +1 -1
- package/lib/markdown/common/mmdRules.js +5 -0
- package/lib/markdown/common/mmdRules.js.map +1 -1
- package/lib/markdown/common/render-table-cell-content.d.ts +6 -0
- package/lib/markdown/common/render-table-cell-content.js +138 -0
- package/lib/markdown/common/render-table-cell-content.js.map +1 -0
- package/lib/markdown/common.d.ts +1 -0
- package/lib/markdown/common.js +3 -2
- package/lib/markdown/common.js.map +1 -1
- package/lib/markdown/md-block-rule/begin-tabular/common.d.ts +1 -1
- package/lib/markdown/md-block-rule/begin-tabular/common.js +5 -2
- package/lib/markdown/md-block-rule/begin-tabular/common.js.map +1 -1
- package/lib/markdown/md-block-rule/begin-tabular/parse-tabular.js +2 -0
- package/lib/markdown/md-block-rule/begin-tabular/parse-tabular.js.map +1 -1
- package/lib/markdown/md-block-rule/begin-tabular/sub-cell.d.ts +3 -0
- package/lib/markdown/md-block-rule/begin-tabular/sub-cell.js +78 -0
- package/lib/markdown/md-block-rule/begin-tabular/sub-cell.js.map +1 -0
- package/lib/markdown/md-block-rule/begin-tabular/sub-tabular.js +21 -0
- package/lib/markdown/md-block-rule/begin-tabular/sub-tabular.js.map +1 -1
- package/lib/markdown/md-inline-rule/diagbox-inline.d.ts +2 -0
- package/lib/markdown/md-inline-rule/diagbox-inline.js +119 -0
- package/lib/markdown/md-inline-rule/diagbox-inline.js.map +1 -0
- package/lib/markdown/md-renderer-rules/render-diagbox.d.ts +3 -0
- package/lib/markdown/md-renderer-rules/render-diagbox.js +49 -0
- package/lib/markdown/md-renderer-rules/render-diagbox.js.map +1 -0
- package/lib/markdown/md-renderer-rules/render-tabular.js +22 -100
- package/lib/markdown/md-renderer-rules/render-tabular.js.map +1 -1
- package/lib/markdown/mdPluginRaw.js +13 -1
- package/lib/markdown/mdPluginRaw.js.map +1 -1
- package/lib/markdown/sanitize/consts.js +1 -1
- package/lib/markdown/sanitize/consts.js.map +1 -1
- package/lib/markdown/sanitize/sanitize-html.js +1 -1
- package/lib/markdown/sanitize/sanitize-html.js.map +1 -1
- package/lib/mathpix-markdown-model/index.d.ts +10 -0
- package/lib/mathpix-markdown-model/index.js.map +1 -1
- package/lib/styles/styles-tabular.js +1 -1
- package/lib/styles/styles-tabular.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -831,12 +831,46 @@ The `MathpixMarkdown` React element accepts the following props:
|
|
|
831
831
|
|
|
832
832
|
### THtmlSanitize
|
|
833
833
|
|
|
834
|
-
|
|
|
835
|
-
|
|
836
|
-
| `disallowedTagsMode`
|
|
837
|
-
|
|
|
838
|
-
|
|
|
839
|
-
|
|
|
834
|
+
| | type *`default`* | description |
|
|
835
|
+
|-------------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------|
|
|
836
|
+
| `disallowedTagsMode` | `string` *`discard`* | `discard` (the default) - disallowed tags are discarded. |
|
|
837
|
+
| | | `escape` - the disallowed tags are escaped rather than discarded. Any text or subtags is handled normally. |
|
|
838
|
+
| | | `recursiveEscape` - the disallowed tags are escaped rather than discarded, and the same treatment is applied |
|
|
839
|
+
| | | to all subtags, whether otherwise allowed or not. |
|
|
840
|
+
| `allowedTags` | `Array<string>` | List of allowed HTML tags. See [default options](https://github.com/Mathpix/mathpix-markdown-it#thtmlsanitize-default-options). |
|
|
841
|
+
| `allowedAttributes` | `Record<string, string[]>` | Defines allowed attributes for specific tags. Example: `{ a: ['href', 'name', 'target'], img: ['src'] }`. |
|
|
842
|
+
| `allowedIframeHostnames` | `Array<string>` | List of allowed hostnames for `<iframe>` sources. Helps prevent embedding unsafe content. |
|
|
843
|
+
| `selfClosing` | `Array<string>` | List of self-closing tags such as `img`, `br`, `hr`, `area`, `base`, `basefont`, `input`, `link`, `meta`. |
|
|
844
|
+
| `allowedSchemes` | `Array<string>` (default: `["http", "https", "ftp", "mailto"]`) | Defines the allowed URL schemes for links, images, and other elements. |
|
|
845
|
+
| `allowedSchemesByTag` | `Record<string, string[]>` | Defines allowed schemes per tag. Example: `{ a: ['http', 'https'], img: ['data'] }`. |
|
|
846
|
+
| `allowedSchemesAppliedToAttributes` | `Array<string>` | Defines which attributes should have their values checked against `allowedSchemes`. Default: `['href', 'src', 'cite']`. |
|
|
847
|
+
| `allowProtocolRelative` | `boolean` *`true`* | If `true`, allows protocol-relative URLs (e.g., `//example.com`). |
|
|
848
|
+
| `enforceHtmlBoundary` | `boolean` *`false`* | If `true`, ensures that sanitized output is enclosed within valid HTML boundaries. |
|
|
849
|
+
| `skipCloseTag` | `boolean` *`false`* | If `true`, skips closing tags in the output. |
|
|
850
|
+
|
|
851
|
+
### HtmlSanitize default options
|
|
852
|
+
|
|
853
|
+
```js
|
|
854
|
+
allowedTags: ['h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol',
|
|
855
|
+
'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'abbr', 'code', 'hr', 'br', 'div',
|
|
856
|
+
'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre', 'u'],
|
|
857
|
+
disallowedTagsMode: 'discard',
|
|
858
|
+
allowedAttributes: {
|
|
859
|
+
a: [ 'href', 'name', 'target' ],
|
|
860
|
+
// We don't currently allow img itself by default, but
|
|
861
|
+
// these attributes would make sense if we did.
|
|
862
|
+
img: [ 'src' ]
|
|
863
|
+
},
|
|
864
|
+
// Lots of these won't come up by default because we don't allow them
|
|
865
|
+
selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],
|
|
866
|
+
// URL schemes we permit
|
|
867
|
+
allowedSchemes: ['http', 'https', 'ftp', 'mailto'],
|
|
868
|
+
allowedSchemesByTag: {},
|
|
869
|
+
allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],
|
|
870
|
+
allowProtocolRelative: true,
|
|
871
|
+
enforceHtmlBoundary: false,
|
|
872
|
+
skipCloseTag: false
|
|
873
|
+
```
|
|
840
874
|
|
|
841
875
|
|
|
842
876
|
### ISmilesOptions
|