Code Monkey home page Code Monkey logo

shaku's People

Contributors

donghy1 avatar jserzanp 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  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

shaku's Issues

Using the user custom naming convention instead of js annotate.

Using the identification js annotate for each code block seems boring,When writing technical articles, we often say something like: "let's create a foo.js file."

  • For example, we can giving a name to this code block, consider the following code snippet:
image
  • We can also enhance its appearance through UI redesign to resemble the image below:
image

Is it necessary to add this feature?

shakuhachi - code explanation with voice.

Motivation

Think about recording a video explaining a piece of code

  1. need screen recording
  2. need editing
  3. upload somewhere
  4. embed as video widget

The problem is Video is too heavy a tool for such use case, what we actually want is

  1. a voice companion for the code snippet
  2. a cursor to indicate where we are.

This actually could be achieved by recording two stream(voice stream, action stream) and put them together.

Design

1. recording

1. voice stream

Just use MediaStream api

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API

2. action stream

We only need to record the important actions, including

  1. mouse click
  2. selection
  3. Shaku-specfic events

Shaku-specific events are events that triggers visual changes on code snippets, e.g.

  1. highlight a line
  2. toggle @ fold

Events must have location information attached to specific lines & characters.

2. Edit (low priority)

It should be feasible to cut the spaces between actions and voice.
If not able to do it automatically, we can at least edit manually.

3. Generating

Voice data and the event streams are bundled together, with time info on one single timeline.

3. Rendering

Just play the voice and events along the timeline.

For fast forward, we just increase the play speed.
For rewind, we need to start from the very start.

We need controls on the UI.

  1. play
  2. pause
  3. progress bar

Create a syntax spec!

After gathering enough use cases, we should consider creating a well-thought spec.

Work with prettier properly

We're developing a component example site that uses prettier and shaku, where prettier users format the code and will format comments related to shaku as well, resulting in a failure to get the results we expect. Currently, we can only partially disable prettier.

enable prettier
image

disable prettier
image

The whole project uses prettier, only the shaku related code snippets can't use prettier, which sucks.

I've come up with an option, but I'm not sure if it's optimal.
image

A module similar to shiki

https://github.com/shikijs/shiki

const shiki = require('shiki')

shiki
  .getHighlighter({
    theme: 'nord'
  })
  .then(highlighter => {
    console.log(highlighter.codeToHtml(`console.log('shiki');`, { lang: 'js' }))
  })

// <pre class="shiki nord" style="background-color: #2e3440"><code>
//   <!-- Highlighted Code -->
// </code></pre>

Add the @hidden feature.

Similar to the code example in this blog post, we can achieve this effect by adjusting the opacity.

image

Referring to the @highlight syntax, I have implemented the @hidden syntax to achieve this effect.

image

Not support highlight in jsx

Describe the bug
Not work when use with react, the code is as bellow,

class Code extends React.PureComponent {
    render(): React.ReactNode {
        return (
            <div className="buttons">
                {/* @highlight start */}
                <Button type="primary">主要</Button>
                <Button>次要</Button>
                <Button type="danger">危险</Button>
                <Button type="important">重要</Button>
                {/* @highlight end */}
            </div>
        );
    }
}

or

class Code extends React.PureComponent {
    render(): React.ReactNode {
        return (
            <div className="buttons">
                // @highlight start
                <Button type="primary">主要</Button>
                <Button>次要</Button>
                <Button type="danger">危险</Button>
                <Button type="important">重要</Button>
                // @highlight end
            </div>
        );
    }
}

but it works well as bellow,

class Code extends React.PureComponent {
    render(): React.ReactNode {
        return (
            // @highlight start
            <div className="buttons">
                <Button type="primary">主要</Button>
                <Button>次要</Button>
                <Button type="danger">危险</Button>
                <Button type="important">重要</Button>
            </div>
            // @highlight end
        );
    }
}

To Reproduce
shaku playground

Expected behavior
works well like this
image

Screenshots
If applicable, add screenshots to help explain your problem.

image

Tutorial on adding a novice to use

I hope you can join some beginner's tutorials in readme,

this can help a lot of people to use these plug-ins,

i'd love to, but I don't know how yet.

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.