jserzanp / shaku Goto Github PK
View Code? Open in Web Editor NEWShaku helps you write better technical articles with code annotation .etc
Home Page: https://shaku-web.vercel.app
License: MIT License
Shaku helps you write better technical articles with code annotation .etc
Home Page: https://shaku-web.vercel.app
License: MIT License
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."
Is it necessary to add this feature?
Think about recording a video explaining a piece of code
The problem is Video is too heavy a tool for such use case, what we actually want is
This actually could be achieved by recording two stream(voice stream, action stream) and put them together.
1. voice stream
Just use MediaStream
api
2. action stream
We only need to record the important actions, including
Shaku-specific events are events that triggers visual changes on code snippets, e.g.
@ fold
Events must have location information attached to specific lines & characters.
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.
Voice data and the event streams are bundled together, with time info on one single timeline.
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.
bring the Themes from Shaku Snippet to Shaku
https://shaku-web.vercel.app/snippet
And allow users to easily config themes
🤔
After gathering enough use cases, we should consider creating a well-thought spec.
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.
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.
if the color is green, // ( g )
is better than // ( 2)
like what react.dev is doing
https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useEffect.md?plain=1#L81
per title
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>
Similar to the code example in this blog post, we can achieve this effect by adjusting the opacity.
Referring to the @highlight
syntax, I have implemented the @hidden
syntax to achieve this effect.
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
Screenshots
If applicable, add screenshots to help explain your problem.
This helps build more robust tools.
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.
Currently it is not possible to annotate the shaku line.
need to vet each language
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.