Skip to content

Commit

Permalink
Add custom pre block
Browse files Browse the repository at this point in the history
  • Loading branch information
robdy authored Dec 17, 2021
1 parent c88a0b1 commit 42afb01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/CodeBlock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

export const CodeBlock = (props) => {
console.log(props.children)
return (
<pre className={props.className}>
{props.children}
</pre>
)
}
2 changes: 2 additions & 0 deletions src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { withPrefix } from 'gatsby'
import { MDXProvider } from '@mdx-js/react'
import { NoteBlock, WarningBlock, TipBlock } from './Block'
import { LinkToAnywhere } from './LinkToAnywhere'
import { CodeBlock } from './CodeBlock'

const TemplateWrapper = ({ children }) => {
const { title, description, siteUrl } = useSiteMetadata()
Expand Down Expand Up @@ -149,6 +150,7 @@ const TemplateWrapper = ({ children }) => {
Warning: WarningBlock,
Tip: TipBlock,
a: LinkToAnywhere,
pre: CodeBlock,
}}
>
{children}
Expand Down

0 comments on commit 42afb01

Please sign in to comment.