-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gatsby-mdx does not work with plugin #1
Comments
@ar-stackrox Do you mind sending a full |
same issue here, this is my
|
Sure, here it is. Trying to use it with gatsby-remark-vscode instead of prism, but I'm loading your plugin before remark-vscode. The build works fine when I remove the code-buttons plugin. I removed the metadata
|
@ar-stackrox Thanks for providing your @luisduenas I will try to look into this issue tomorrow morning. |
@iamskok No problem! I'm actually already using that plugin and it works fine - |
@ar-stackrox What I meant is if you could comment out gatsby-remark-code-buttons and paste gatsby-remark-code-titles on its place (from my experience the order of the plugins might sometimes matter) and see if we have any errors. I’m trying to understand if this issue is specific to this plugin or other plugins are affected as well. gatsby-remark-code-titles is a good candidate for this test bc these plugins are very similar with each other. And I also forgot to ask you for a copy |
here's my
|
oh, and i forgot to say, i installed |
@luisduenas Thank you. I started looking at it this morning but didn't have enough time to figure it out. Will try to spend more time in the next couple of days. |
@ar-stackrox @luisduenas I tried reproducing this issue by cloning My build was clean however the copy button wasn't working bc |
Sent with GitHawk |
@iamskok: Thank your for your plugin! I am trying to let Everything but "gatsby-remark-code-buttons" works as expected: It would be nice if you could me help out to fix it. Please find my code below:
package.json{
"name": "fluency-framework",
"version": "0.1.0",
"description": "Build responsive, mobile-first projects on the web with the world’s most advanced front-end component library.",
"private": true,
"author": "Arno Rinker <[email protected]>",
"browserslist": [
"ie >= 11",
"last 3 edge versions",
"last 3 firefox major versions",
"last 3 chrome versions",
"last 3 safari versions",
"last 3 opera versions"
],
"dependencies": {
"@deckdeckgo/highlight-code": "^1.0.0-rc.2-1",
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-brands-svg-icons": "^5.11.2",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/pro-light-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.7",
"@mdx-js/mdx": "^1.5.3",
"@mdx-js/react": "^1.5.3",
"babel-plugin-styled-components": "^1.10.6",
"gatsby": "^2.18.21",
"gatsby-image": "^2.2.30",
"gatsby-plugin-manifest": "^2.2.25",
"gatsby-plugin-mdx": "^1.0.67",
"gatsby-plugin-offline": "^3.0.17",
"gatsby-plugin-postcss-sass": "^1.0.22",
"gatsby-plugin-react-helmet": "^3.1.13",
"gatsby-plugin-sass": "^2.1.20",
"gatsby-plugin-sharp": "^2.2.34",
"gatsby-plugin-styled-components": "^3.1.13",
"gatsby-remark-code-buttons": "^2.0.4",
"gatsby-remark-prismjs": "^3.3.30",
"gatsby-source-filesystem": "^2.1.35",
"gatsby-transformer-remark": "^2.6.48",
"gatsby-transformer-sharp": "^2.3.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"sass": "^1.23.3",
"styled-components": "^4.4.1"
},
"devDependencies": {
"prettier": "^1.18.2"
},
"keywords": [
"fluency"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/arinker/fluency"
},
"bugs": {
"url": "https://github.com/arinker/fluency/issues"
}
} gatsby.config.jsmodule.exports = {
siteMetadata: {
title: `fluency`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
menuLinks: [{…}]
},
plugins: [
`gatsby-plugin-react-helmet`, {
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-styled-components`, {
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [{
resolve: 'gatsby-remark-code-buttons',
options: {
buttonText: `<p>Copy to Clipboard</p>`,
svgIcon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M336 64h-88.6c.4-2.6.6-5.3.6-8 0-30.9-25.1-56-56-56s-56 25.1-56 56c0 2.7.2 5.4.6 8H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 32c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm160 432c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16h48v20c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12V96h48c8.8 0 16 7.2 16 16z"></path></svg>`,
tooltipText: `Copy to Clipboard`,
toasterText: 'Copied to Clipboard',
toasterDuration: 5000
}
}, {
resolve: `gatsby-remark-prismjs`
}]
}
}, {
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
}
}, {
resolve: `gatsby-plugin-sass`,
options: {
implementation: require("sass")
}
}
// this (optional) plugin enables Progressive Web App + Offline functionality To
// learn more, visit: https://gatsby.dev/offline `gatsby-plugin-offline`,
]
} gatsby.browser.jsimport './src/styles/documentation.scss';
require("prismjs/themes/prism-okaidia.css")
require("prismjs/plugins/line-numbers/prism-line-numbers.css") index.jsimport React from "react"
import Layout from "../components/layout"
import SEO from "../components/seo"
import GetStarted from '../docs/get-started.mdx'
const IndexPage = () => (
<Layout>
<SEO title="Get Started"/>
<section class={`documentation`}>
<GetStarted/>
</section>
<div>
<p>Hallo</p>
</div>
</Layout>
)
export default IndexPage get-started.mdx# Get started with fluency
```html
<html lang="en" dir="ltr">
<head><!-- Your head goes here --></head>
<body id="fluency" class="no-js">
<div id="mq"></div>
<div id="screen" class="">
<script>
function setMediaQuery() {
var element = document.getElementById('mq');
var target = document.getElementById('screen');
var style = getComputedStyle(element);
var mq = style['zIndex'];
target.className = ('mq' + mq);
}
(function() { setMediaQuery(); })();
window.addEventListener("resize", function(){ setMediaQuery(); });
</script>
<div id="overlays">
<!-- Your Overlays go here -->
</div>
<div id="page-and-offcanvas">
<div id="offcanvas-left" class="offcanvas left closed">
<!-- Your Left Offcanvas goes here -->
</div>
<div id="page">
<div id="page-background">
<!-- Your Page Background goes here -->
</div>
<div id="page-border-wrapper">
<div id="header-and-main">
<header id="header">
<!-- Your Header goes here -->
</header>
<main id="main">
<!-- Your Main Content goes here -->
</main>
</div>
<footer id="footer">
<!-- Your Footer Content goes here -->
</footer>
</div>
</div>
<div id="offcanvas-right" class="offcanvas right closed">
<!-- Your Right Offcanvas goes here -->
</div>
</div>
</div>
<!-- Your Body Scripts go here -->
</body>
</html> Console ERRORError onLoadindex.js:2177 Warning: Expected `onClick` listener to be a function, instead got a value of `string` type.
in div (created by MDXCreateElement)
in MDXCreateElement (at get-started.mdx:24)
in wrapper (created by MDXCreateElement)
in MDXCreateElement (at get-started.mdx:21)
in MDXContent (at pages/index.js:11)
in section (at pages/index.js:10)
in section (at layout.js:182)
in div (at layout.js:180)
in div (at layout.js:179)
in div (at layout.js:177)
in div (at layout.js:175)
in div (at layout.js:173)
in div (at layout.js:171)
in div (created by Context.Consumer)
in StyledComponent (created by layout__AppMain)
in layout__AppMain (at layout.js:170)
in div (created by Context.Consumer)
in StyledComponent (created by layout__AppHeaderAndMain)
in layout__AppHeaderAndMain (at layout.js:164)
in div (created by Context.Consumer)
in StyledComponent (created by layout__AppPage)
in layout__AppPage (at layout.js:162)
in div (created by Context.Consumer)
in StyledComponent (created by layout__AppPageAndOffcanvas)
in layout__AppPageAndOffcanvas (at layout.js:156)
in div (created by Context.Consumer)
in StyledComponent (created by layout__App)
in layout__App (at layout.js:154)
in Layout (at pages/index.js:8)
in IndexPage (created by HotExportedIndexPage)
in AppContainer (created by HotExportedIndexPage)
in HotExportedIndexPage (created by PageRenderer)
in PageRenderer (at query-result-store.js:86)
in PageQueryStore (at root.js:51)
in RouteHandler (at root.js:73)
in div (created by FocusHandlerImpl)
in FocusHandlerImpl (created by Context.Consumer)
in FocusHandler (created by RouterImpl)
in RouterImpl (created by Context.Consumer)
in Location (created by Context.Consumer)
in Router (created by EnsureResources)
in ScrollContext (at root.js:64)
in RouteUpdates (at root.js:63)
in EnsureResources (at root.js:61)
in LocationHandler (at root.js:119)
in LocationProvider (created by Context.Consumer)
in Location (at root.js:118)
in Root (at root.js:126)
in MDXProvider (at wrap-root-element.js:65)
in MDXScopeProvider (at wrap-root-element.js:64)
in Unknown
in Unknown (at wrap-root-element.js:72)
in StaticQueryStore (at root.js:133)
in _default (at app.js:67)
__stack_frame_overlay_proxy_console__ @ index.js:2177
warningWithoutStack @ react-dom.development.js:531
warning @ react-dom.development.js:1019
warnForInvalidEventListener @ react-dom.development.js:7652
setInitialDOMProperties @ react-dom.development.js:7741
setInitialProperties @ react-dom.development.js:7951
finalizeInitialChildren @ react-dom.development.js:9479
completeWork @ react-dom.development.js:21094
completeUnitOfWork @ react-dom.development.js:24729
performUnitOfWork @ react-dom.development.js:24705
workLoopSync @ react-dom.development.js:24670
performSyncWorkOnRoot @ react-dom.development.js:24269
scheduleUpdateOnFiber @ react-dom.development.js:23697
updateContainer @ react-dom.development.js:27102
(anonymous) @ react-dom.development.js:27527
unbatchedUpdates @ react-dom.development.js:24432
legacyRenderSubtreeIntoContainer @ react-dom.development.js:27526
render @ react-dom.development.js:27607
(anonymous) @ app.js:67
setTimeout (async)
(anonymous) @ ready.js:32
(anonymous) @ app.js:66
Promise.then (async)
(anonymous) @ app.js:59
Promise.then (async)
(anonymous) @ app.js:23
./.cache/app.js @ app.js:16
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
0 @ documentation.scss?3e0d:45
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793 Error onClickUncaught Error: Expected `onClick` listener to be a function, instead got a value of `string` type.
at getListener (react-dom.development.js:846)
at listenerAtPhase (react-dom.development.js:4743)
at accumulateDirectionalDispatches (react-dom.development.js:4768)
at traverseTwoPhase (react-dom.development.js:4673)
at accumulateTwoPhaseDispatchesSingle (react-dom.development.js:4786)
at forEachAccumulated (react-dom.development.js:695)
at accumulateTwoPhaseDispatches (react-dom.development.js:4821)
at Object.extractEvents (react-dom.development.js:5681)
at extractPluginEvents (react-dom.development.js:868)
at runExtractedPluginEventsInBatch (react-dom.development.js:880)
at handleTopLevel (react-dom.development.js:5804)
at batchedEventUpdates$1 (react-dom.development.js:24400)
at batchedEventUpdates (react-dom.development.js:1416)
at dispatchEventForPluginEventSystem (react-dom.development.js:5895)
at attemptToDispatchEvent (react-dom.development.js:6011)
at dispatchEvent (react-dom.development.js:5915)
at unstable_runWithPriority (scheduler.development.js:697)
at runWithPriority$2 (react-dom.development.js:12150)
at discreteUpdates$1 (react-dom.development.js:24416)
at discreteUpdates (react-dom.development.js:1439)
at dispatchDiscreteEvent (react-dom.development.js:5882)
getListener @ react-dom.development.js:846
listenerAtPhase @ react-dom.development.js:4743
accumulateDirectionalDispatches @ react-dom.development.js:4768
traverseTwoPhase @ react-dom.development.js:4673
accumulateTwoPhaseDispatchesSingle @ react-dom.development.js:4786
forEachAccumulated @ react-dom.development.js:695
accumulateTwoPhaseDispatches @ react-dom.development.js:4821
extractEvents @ react-dom.development.js:5681
extractPluginEvents @ react-dom.development.js:868
runExtractedPluginEventsInBatch @ react-dom.development.js:880
handleTopLevel @ react-dom.development.js:5804
batchedEventUpdates$1 @ react-dom.development.js:24400
batchedEventUpdates @ react-dom.development.js:1416
dispatchEventForPluginEventSystem @ react-dom.development.js:5895
attemptToDispatchEvent @ react-dom.development.js:6011
dispatchEvent @ react-dom.development.js:5915
unstable_runWithPriority @ scheduler.development.js:697
runWithPriority$2 @ react-dom.development.js:12150
discreteUpdates$1 @ react-dom.development.js:24416
discreteUpdates @ react-dom.development.js:1439
dispatchDiscreteEvent @ react-dom.development.js:5882 |
@arinker thanks for your detailed issue! This plugin doesn't support MDX, but you are more than welcome to submit a PR and I will try to help you along the way. Let me know if you would like to reopen this issue? |
@iamskok Thank you for your quick reply and offer to help! Unfortunately we do not have the resources to go deeper into your plugin. Thus we cannot submit a PR and have to live without the plugin for the time being. |
Does this mean in order to use the plugin we must only use it with .md files? Is that how the main gatsby site works? What about https://github.com/iamskok/gatsby-mdx-remark-code-buttons-example (I could not get it to work btw)? If the button will not work with MDX, could you please unequivocally add that to the docs/readme. I literally spent the last five hours trying to get it to work :( I tried so many things. Anyway, thank you I will use it on my .md sites, I just can't use it today. -DK ps. if you'd like to take a look at how I was trying to get it to work: https://github.com/davidkartuzinski/gatsby-theme-naked-core/tree/code-copy-link Thanks again. |
@davidkartuzinski thanks, David! The docs were updated. Now there is a link for MDX copy button example as well. |
@iamskok Thank you for your answer. I am a little confused. I read the docs on gatsby and I don't see any changes or anything about using gatsy-remark-code-buttons with MDX. I looked at the readme. The readme seems to say that this will NOT work with MDX. This example repo https://github.com/iamskok/gatsby-mdx-remark-code-buttons-example - does not work. Does the button work with MDX? Thank you for your attention, I would love to use your hard work to help my readers. Thank you. -DK |
@davidkartuzinski this plugin it’s not working with MDX, but I have referenced an example from Gatsby’s website on how to add a copy button with MDX. gatsbyjs/gatsby#15834 |
@iamskok Thank you! Now I understand. I can now try to figure it out. I really appreciate it. Thank you. |
After NPM install and adding it to the gatsby-config, the following errors are displayed.
Has also been verified by others.
The text was updated successfully, but these errors were encountered: