Git Product home page Git Product logo

player's Introduction

Kodemo

Kodemo

Kodemo is a new format for more engaging and interactive technical documentation. It's great for tutorials and walkthroughs.

Kodemo Player

This repo contains the @kodemo/player package which is responsible for rendering and navigating Kodemo documents. The player is a React component and it needs to be provided with a valid Kodemo document.

Installation

To install and integrate @kodemo/player please follow the docs at https://kodemo.com/docs/player.

TLDR?

  1. Install @kodemo/player using your package manager of choice:
npm i @kodemo/player # yarn add @kodemo/player
  1. Import and render the KodemoPlayer component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { KodemoPlayer } from '@kodemo/player';

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <KodemoPlayer json={{
      story: '<h1>Example Document</h1>',
      subjects: {
        f992151a: {
          type: 'code',
          name: 'file.js',
          language: "javascript",
          versions: {
            e60944c4: { value: 'const a = 123;', },
          }
        }
      }
    }}></KodemoPlayer>
  </React.StrictMode>
)

Development Setup

If you want to make changes to the @kodemo/player source here's how:

  1. Clone this repository
  2. Run yarn install
  3. Run yarn dev to start the development server
  4. Open the URL from the dev server output and ๐Ÿ’ฅ

Other scripts

# run tests
yarn test

# build a new release
yarn build

Adding New Subject Types

Each subject in Kodemo is its own React component. You can easily add your own subject types by following these steps:

  1. Create your subject component in the subjects directory. I recommend using AbstractSubject as a starting point.
  2. Export your subject from subjects/index.ts.
  3. Add your subject to enum/SubjectType.ts.

Terminology

If you're planning to work with the Kodemo source here are a few key concepts and names that are good to know about.

  • The story is the main body text of the documentation.
  • Subjects are the individual pieces of content that the documentation covers. A subject can be an image, code, etc.
  • Subjects can have multiple versions. Each version represents a variant of the same subject. For example, multiple versions are used to animate lines being added or removed from code.
  • The timeline is the bar with vertical line segments that indicate which subject that will become active when scrolling.
  • Effects are keywords within the story that are linked to a specific subject version. They form the relationship between the story and subjects.

MIT licensed | Copyright ยฉ 2022-2023 Hakim El Hattab, https://hakim.se

player's People

Contributors

hakimel avatar

Watchers

 avatar

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.