@readme/markdown 6.75.0-beta.56 → 6.75.0-beta.58

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 CHANGED
@@ -91,7 +91,7 @@ Extends [`RunOptions`](https://mdxjs.com/packages/mdx/#runoptions)
91
91
  - `components` (`Record<string, MDXModule>`, optional) -- An object of tag names to executed components.
92
92
  - `imports` (`Record<string, unknown>`, optional) -- An object of modules to import.
93
93
  - `terms` (`GlossaryTerm[]`, optional)
94
- - `variables` (`Variables`, optional)
94
+ - `variables` (`Variables`, optional) -- An object containing [user variables}(https://github.com/readmeio/variable).
95
95
 
96
96
  ### `RMDXModule`
97
97
 
@@ -55,7 +55,7 @@ const Code = (props: CodeProps) => {
55
55
  };
56
56
 
57
57
  const code = value ?? (Array.isArray(children) ? children[0] : children) ?? '';
58
- const highlightedCode = syntaxHighlighter && code ? syntaxHighlighter(code, language, codeOpts) : code;
58
+ const highlightedCode = syntaxHighlighter && code ? syntaxHighlighter(code, language, codeOpts, { mdx: true }) : code;
59
59
 
60
60
  return (
61
61
  <>
@@ -35,7 +35,19 @@ const Embed = ({
35
35
  ...attrs
36
36
  }: EmbedProps) => {
37
37
  if (typeof iframe !== 'boolean') iframe = iframe === 'true';
38
- if (html === 'false') html = undefined;
38
+
39
+ if (html) {
40
+ try {
41
+ if (html !== decodeURIComponent(html)) {
42
+ html = decodeURIComponent(html);
43
+ } else if (html === 'false') {
44
+ html = undefined;
45
+ }
46
+ } catch (e) {
47
+ // html wasn't HTML apparently
48
+ html = undefined;
49
+ }
50
+ }
39
51
 
40
52
  if (iframe) {
41
53
  return <iframe {...attrs} src={url} style={{ border: 'none', display: 'flex', margin: 'auto' }} />;
@@ -54,7 +66,7 @@ const Embed = ({
54
66
  return (
55
67
  <div className={classes.join(' ')}>
56
68
  {html ? (
57
- <div className="embed-media" dangerouslySetInnerHTML={{ __html: decodeURIComponent(html) }} />
69
+ <div className="embed-media" dangerouslySetInnerHTML={{ __html: html }} />
58
70
  ) : (
59
71
  <a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
60
72
  {!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : undefined} src={image} />}