Code Monkey home page Code Monkey logo

gatsby-starter-blog-mdx's Introduction

Gatsby

Gatsby's blog starter now with 100% more MDX

Kick off your project with this blog boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React, with support for an MDX blog.

Have another more specific idea? You may want to check out this awesome collection of official and community-created starters.

What's MDX you ask? MDX let's you use JSX in your Markdown, making it even easier to write blog posts, document your React components, and much more. Find out more about MDX, and gatsby-mdx, the plugin that makes this blog possible!

πŸš€ Quick start

  1. Create a Gatsby site.

    Use the Gatsby CLI to create a new site, specifying the blog starter.

    # create a new Gatsby site using the blog starter
    npx gatsby new my-blog-starter https://github.com/hagnerd/gatsby-starter-blog-mdx
  2. Start developing.

    Navigate into your new site’s directory and start it up.

    cd my-blog-starter/
    gatsby develop
  3. Open the source code and start editing!

    Your site is now running at http://localhost:8000!

    Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

    Open the my-blog-starter directory in your code editor of choice and edit src/pages/index.js. Save your changes and the browser will update in real time!

πŸ’« Deploy

Deploy to Netlify

gatsby-starter-blog-mdx's People

Contributors

bartwaardenburg avatar christopherbiscardi avatar d4rekanguok avatar dzello avatar jayantbh avatar lsirivong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gatsby-starter-blog-mdx's Issues

Not working in Windows

Hi!

I just would like to let you know it currently isn't working in Windows 10. Created a brand new project with this builder, ran yarn start and the error message below appears.

Yarn version: 1.12.3
Node version: 10.14.2
Gatsby-cli version: 2.4.8

image
image

Looks like some path issues because the file does exist:
image

But the error is printing out stuff without slashes so might be some other package conflicting. Would you happen to know which?

Git Command is incorrect

Hey, just wanted to point out a small little thing on the readme, thanks for a great template!

Currently on readme.md:

# create a new Gatsby site using the blog starter
npx gatsby new my-blog-starter
https://github.com/hagner/gatsby-starter-blog-mdx

Should be:

# create a new Gatsby site using the blog starter
npx gatsby new my-blog-starter
https://github.com/hagnerd/gatsby-starter-blog-mdx

The issue is a missing 'd' in your username on the git command.

Something's wrong with wrap root element?

Hi Matt @hagnerd,

I am struggling with adding components to the MDXProviders global scope and I am seeing this error when compiling a blogpost using this component:
Component SCM was not imported, exported, or provided by MDXProvider as global scope

I simply extended the existing wrap-root-element.js

const components = {
  pre: preProps => {
    const props = preToCodeBlock(preProps)
    // if there's a codeString and some props, we passed the test
    if (props) {
      return <Code {...props} />
    } else {
      // it's possible to have a pre without a code in it
      return <pre {...preProps} />
    }
  },
  SCM: props => {return <SCM {...props} />}
}

export const wrapRootElement = ({ element }) => (
  <MDXProvider components={components}>
    {element}
  </MDXProvider>
)

I started wondering whether this MDXProvider was being used at all? Even if I inspect the code elements in your live demo this is what I am seeing
Screenshot 2019-11-28 at 12 44 08

instead of something like this (from the code.js):

export const Code = ({ codeString, language, ...props }) => {
  if (props['react-live']) {
    return (
      <LiveProvider code={codeString} noInline={true}>
        <LiveEditor />
        <LiveError />
        <LivePreview />
      </LiveProvider>
    )
  } else {
    return (
      <Highlight {...defaultProps} code={codeString} language={language}>
        {({ className, style, tokens, getLineProps, getTokenProps }) => (
          <pre className={className} style={style}>
            {tokens.map((line, i) => (
              <div {...getLineProps({ line, key: i })}>
                {line.map((token, key) => (
                  <span {...getTokenProps({ token, key })} />
                ))}
              </div>
            ))}
          </pre>
        )}
      </Highlight>
    )
  }
}

So it seems to me pre isn't overwritten by the MDXProvider either and this just has gone unnoticed since there is an existing component for pre. I am pretty new to Gatsby and frontend dev in general so I kinda hit a wall here and was wondering if there was something wrong that you would spot?

Best,
Thomas

Change react-live LiveEditor from 13px to 16px?

I can't seem to figure out how to change the font-size. Could someone help me out?

CleanShot 2020-07-07 at 20 22 27@2x

<LiveProvider code={codeString} noInline={true}>
        <LiveEditor theme={dracula} padding={`15px`} fontSize={26} ???? />
        <LiveError />
        <LivePreview />
</LiveProvider>

Let me know, thanks!

Import Components into .mdx files?

It is my understanding, per https://mdxjs.com/advanced/components , that React components can be imported into MDX files.

When I run the starter and add a blog to the content folder it crashes.

content
  - my-new-blog
      - index.mdx
      - MyComponent.js

index.mdx:

---
title: Brian's Brain!
date: '2020-01-01'
---

import MyComponent from './MyComponent.js'

## Above component

<MyComponent />

## Below Component

MyComponent.js:

import React from 'react';

const MyComponent = props => {
    return (
        <div>
            <h3>Hello MyComponent</h3>
        </div>
    );
};

export default MyComponent;

Is importing React components not supported?

TypeScript support

I was using this starter for a project, but I try to write as much of my code in TS as possible.
It wasn't too difficult to get it working with TS.

I'm open to submitting a PR for this. Let me know your thoughts on this.

Fails to build on filesystems with case sensitivity

Steps to reproduce: build the current version on Netlify.

This is because the imports import a file called Layout when the file is actually called layout.js but filesystems with case insensitivty, like Mac, don't care.

I'll submit a PR renaming layout.js to Layout.js to match the blog starter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.