Skip to content

Commit

Permalink
🐛 Fix ESM packaging for code-highlighting (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 authored Oct 5, 2023
1 parent b86d16b commit d31527b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-mayflies-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Fix ESM import of code styles
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions packages/myst-to-react/src/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { Code, InlineCode } from 'myst-spec';
import type { NodeRenderer } from '@myst-theme/providers';
import { useTheme } from '@myst-theme/providers';
import { LightAsync as SyntaxHighlighter } from 'react-syntax-highlighter';
import light from 'react-syntax-highlighter/dist/esm/styles/hljs/xcode';
import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015';
import light from 'react-syntax-highlighter/dist/esm/styles/hljs/xcode.js';
import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015.js';
import { DocumentIcon } from '@heroicons/react/24/outline';
import classNames from 'classnames';
import { CopyIcon } from './components/index.js';
Expand Down
1 change: 0 additions & 1 deletion patches
Submodule patches deleted from 0bfbcc
15 changes: 15 additions & 0 deletions patches/@jupyter-widgets+controls+5.0.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/node_modules/@jupyter-widgets/controls/css/widgets-base.css b/node_modules/@jupyter-widgets/controls/css/widgets-base.css
index b5c14f8..4f481fa 100644
--- a/node_modules/@jupyter-widgets/controls/css/widgets-base.css
+++ b/node_modules/@jupyter-widgets/controls/css/widgets-base.css
@@ -8,8 +8,8 @@
* have been defined.
*/

-@import './lumino.css';
-@import './nouislider.css';
+/* @import './lumino.css'; */
+/* @import './nouislider.css'; */

:root {
--jp-widgets-color: var(--jp-content-font-color1);
26 changes: 26 additions & 0 deletions patches/@types+react-syntax-highlighter+15.5.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/@types/react-syntax-highlighter/index.d.ts b/node_modules/@types/react-syntax-highlighter/index.d.ts
index 413c917..4a9c465 100755
--- a/node_modules/@types/react-syntax-highlighter/index.d.ts
+++ b/node_modules/@types/react-syntax-highlighter/index.d.ts
@@ -696,11 +696,21 @@ declare module 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015' {
export default style;
}

+declare module 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015.js' {
+ const style: { [key: string]: React.CSSProperties };
+ export default style;
+}
+
declare module 'react-syntax-highlighter/dist/esm/styles/hljs/xcode' {
const style: { [key: string]: React.CSSProperties };
export default style;
}

+declare module 'react-syntax-highlighter/dist/esm/styles/hljs/xcode.js' {
+ const style: { [key: string]: React.CSSProperties };
+ export default style;
+}
+
declare module 'react-syntax-highlighter/dist/esm/styles/hljs/xt256' {
const style: { [key: string]: React.CSSProperties };
export default style;

0 comments on commit d31527b

Please sign in to comment.