dekk-app / dekk

👁 A presentation tool written in react.js

Home Page:https://dekk-app.github.io/dekk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use "Code"

TimPietrusky opened this issue · comments

Issue description

The documentation is missing an example on how Code should be used.

I'm trying it like this, but I only get errors:

      <Code>
        const helloWorld = foo => {
          console.log(foo)
        }
      </Code>

or like this:

      <Code>
      {
        const helloWorld = foo => {
          console.log(foo)
        }
      }
      </Code>

Steps to reproduce

  • Open Code documentation

Versions

  1. dekk: 1.0.0-17

The documentation simply links to https://github.com/conorhastings/react-syntax-highlighter.

The code has to be a string

<Code>
  {`
    const helloWorld = foo => {
      console.log(foo)
    }
  `}
</Code>
const code = `
  const helloWorld = foo => {
    console.log(foo)
  }
`
<Code>
  {code}
</Code>

Thank you! Would love to see this as part of the official documentation.

Also how to set the styling / formatting / language of the Code element.