Skip to content

Added custom remark transform for Codepen example links #251

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

Merged
merged 5 commits into from
Nov 7, 2017

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Nov 6, 2017

Relates to #246

Given a directory structure with Codepen examples like so:
screen shot 2017-11-06 at 11 04 02 pm

Markdown links are automatically converted to HTML links to open the example code in question:

<!-- before -->
[](codepen://components-and-props/rendering-a-component)

<!-- after -->
<a href="/codepen/components-and-props/rendering-a-component" target="_blank">
  Try it on CodePen
</a>

<!-- before -->
[Try this Hello World example code on CodePen](codepen://hello-world)

<!-- after -->
<a href="/codepen/hello-world" target="_blank">
  Try this Hello World example code on CodePen
</a>

The generated links point to Gatsby redirect pages that use Codepen's prefill API to create a working pen with the linked example code.

Links are also verified to ensure that they reference valid example files. For example, if there is a link to codepen://components-and-props/rendering-a-component, our Gatsby plug-in will verify that the file /codepen/components-and-props/rendering-a-component.js exists. This will avoid broken links at runtime.

@reactjs-bot
Copy link

reactjs-bot commented Nov 6, 2017

Deploy preview ready!

Built with commit 4614ab0

https://deploy-preview-251--reactjs.netlify.com

@bvaughn bvaughn mentioned this pull request Nov 6, 2017
4 tasks
@bvaughn bvaughn merged commit d818d7c into reactjs:master Nov 7, 2017
@bvaughn bvaughn deleted the gatsby-remark-codepen-examples branch November 7, 2017 10:42
BetterZxx pushed a commit to BetterZxx/react.dev that referenced this pull request Mar 21, 2023
docs(en): merge reactjs.org into zh-hans @ 8994112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants