How to use gatsby-tinacms-remark - 5 common examples

To help you get started, we’ve selected a few gatsby-tinacms-remark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinacms / tinacms / packages / demo-gatsby / src / components / layout.js View on Github external
marginLeft: `auto`,
            marginRight: `auto`,
            maxWidth: rhythm(24),
            padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
          }}
        >
          © {new Date().getFullYear()}, Built with
          {` `}
          <a href="https://www.gatsbyjs.org">Gatsby</a>
        
      
    )
  }
}

const CreatePostPlugin = createRemarkButton({
  label: "Create Post",
  filename({ title }) {
    return `content/blog/${title.replace(/\s+/g, "-").toLowerCase()}/index.md`
  },
  frontmatter({ title }) {
    // Asynchronously generate front matter by fetching data from some server.
    return new Promise(resolve =&gt; {
      setTimeout(() =&gt; {
        resolve({
          title,
          date: new Date(),
          heading_color: "pink",
          description: "My new post. ",
        })
      }, 1000)
    })
github tinacms / tinacms / packages / demo-gatsby / src / templates / blog-post.js View on Github external
return "packages/demo-gatsby" + postDirectory
      },

      // Generate the src attribute for the preview image.
      previewSrc: (formValues, { input }) => {
        let path = input.name.replace("rawFrontmatter", "frontmatter")
        let gastbyImageNode = get(formValues, path)
        if (!gastbyImageNode) return ""
        return gastbyImageNode.childImageSharp.fluid.src
      },
    },
  ],
}

export default liveRemarkForm(BlogPostTemplate, BlogPostForm)

export const pageQuery = graphql`
  query BlogPostBySlug($slug: String!) {
    site {
      siteMetadata {
        title
        author
      }
    }
    markdownRemark(fields: { slug: { eq: $slug } }) {
      ...TinaRemark
      id
      excerpt(pruneLength: 160)
      html
      frontmatter {
        blocks {
github tinacms / tina-starter-grande / src / components / siteLayout.js View on Github external
&lt;&gt;
      
        
      
      
        
          <header>
          {children}
          <footer>
        
      
    
  )
}

const CreatePostButton = createRemarkButton({
  label: "New Post",
  filename(form) {
    let slug = slugify(form.title.toLowerCase())
    return `content/posts/${slug}.md`
  },
  frontmatter(form) {
    let slug = slugify(form.title.toLowerCase())
    return new Promise(resolve =&gt; {
      setTimeout(() =&gt; {
        resolve({
          title: form.title,
          date: new Date(),
          type: "post",
          path: `/blog/${slug}`,
          draft: true,
        })</footer></header>
github tinacms / tina-starter-grande / src / templates / contact.js View on Github external
component: "text",
    },
    {
      label: "Recipient",
      name: "rawFrontmatter.recipient",
      component: "text",
    },
    {
      label: "Body",
      name: "rawMarkdownBody",
      component: "markdown",
    },
  ],
}

export default remarkForm(Contact, ContactForm)

export const Form = styled.form`
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  grid-gap: 1.5rem;
  justify-items: stretch;

  @media (min-width: ${props => props.theme.breakpoints.medium}) {
    grid-template-columns: 1fr 1fr;
  }
`

export const FormField = styled.div`
  input,
  textarea {
github tinacms / tina-starter-grande / src / templates / post.js View on Github external
!formValues.frontmatter.hero ||
              !formValues.frontmatter.hero.image
            )
              return ""
            return formValues.frontmatter.hero.image.childImageSharp.fluid.src
          },
        },
        {
          label: "Body",
          name: "rawMarkdownBody",
          component: "markdown",
        },
      ],
    }
  }, [])
  const [markdownRemark, form] = useLocalRemarkForm(
    props.data.markdownRemark,
    PostForm
  )

  return (
    
      {editingProps =&gt; {
        return (
          
        )
      }}

gatsby-tinacms-remark

A Gatsby/Tina plugin for **editing Markdown files stored in git**.

Apache-2.0
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis