import { parse, parseBuffer } from "@leonmin/md";
function Markdown() {
const handleChange = (e: React.FormEvent<HTMLInputElement> & any) => {
const reader = new FileReader();
const files = e.target.files;
if (files && files.length > 0) {
const file = e.target.files[0];
reader.readAsArrayBuffer(file);
reader.onload = (evt) => {
console.log(parseBuffer(evt.target?.result as ArrayBuffer));
};
}
};
return (
<div>
<input
onChange={(e: React.FormEvent<HTMLInputElement>) => handleChange(e)}
/>
</div>
);
}