
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
ByteMD is a Markdown editor component built with Svelte. It could also be used in other libraries/frameworks such as React, Vue and Angular.
Note: It is still in development
<script>
and <img onerror>
have been correctly handled by ByteMD. No need to introduce extra DOM sanitize steps.Package | Status | Description |
---|---|---|
bytemd | Svelte/Vanilla JS component | |
@bytemd/react | React component | |
@bytemd/vue | Vue component |
There are two components: Editor
and Viewer
. Editor
is the Markdown editor, as the name suggests; Viewer
is commonly used to display rendered Markdown results without editing.
Before using the component, remember to import CSS file to make styles correct:
import 'bytemd/dist/index.css';
<template>
<Editor {value} on:change={handleChange} plugins={[{/* Add plugins here */}]} />
</template>
<script>
import { Editor, Viewer } from 'bytemd'
let value;
function handleChange(e) {
value = e.detail.value
}
</script>
import { Editor, Viewer } from '@bytemd/react';
const App = () => {
const [value, setValue] = useState('');
return (
<Editor
value={value}
onChange={(v) => {
setValue(v);
}}
plugins={
[
// Add plugins here
]
}
/>
);
};
<template>
<Editor :value="value" @change="handleChange" :plugins="plugins" />
</template>
<script>
import { Editor, Viewer } from '@bytemd/vue';
export default {
components: {
Editor,
},
data() {
return {
value: '',
plugins: [
// Add plugins here
],
};
},
methods: {
handleChange(v) {
value = v;
},
},
};
</script>
import { Editor, Viewer } from 'bytemd';
const instance = new Editor({
target: document.body, // DOM to render
props: {
value: '',
plugins: [
// Add plugins here
],
},
});
instance.on('change', (e) => {
const value = e.detail.value;
console.log(value);
// ...
});
ByteMD uses remark and rehype ecosystem to process Markdown. The complete process is as follows:
It could also be described as a flowchart:
The 2,5,7 steps are designed for user customization via ByteMD plugin API.
Package | Status | Description |
---|---|---|
@bytemd/plugin-breaks | ByteMD plugin to support breaks | |
@bytemd/plugin-external-links | ByteMD plugin to open external links in new window | |
@bytemd/plugin-footnotes | ByteMD plugin to support footnotes | |
@bytemd/plugin-frontmatter | ByteMD plugin to support frontmatter | |
@bytemd/plugin-highlight | ByteMD plugin to highlight code blocks | |
@bytemd/plugin-highlight-ssr | ByteMD plugin to highlight code blocks (SSR compatible) | |
@bytemd/plugin-import-html | ByteMD plugin to import HTML by pasting or dropping | |
@bytemd/plugin-import-image | ByteMD plugin to import image by pasting or dropping | |
@bytemd/plugin-math | ByteMD plugin to support math equation | |
@bytemd/plugin-math-ssr | ByteMD plugin to support math equation (SSR compatible) | |
@bytemd/plugin-medium-zoom | ByteMD plugin to zoom images like Medium | |
@bytemd/plugin-mermaid | ByteMD plugin to support Mermaid diagram and flowchart | |
@bytemd/plugin-scroll-sync | ByteMD plugin to sync scroll position of edit and preview area | |
@bytemd/plugin-vega | ByteMD plugin to support vega charts |
TODO
MIT
FAQs
Hackable Markdown Editor and Viewer
The npm package bytemd receives a total of 3,849 weekly downloads. As such, bytemd popularity was classified as popular.
We found that bytemd demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.