Extra contents beyond WaniKani
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
877 B

import fs from 'fs';
import { radicals } from './beautify-radicals';
async function main() {
const map = radicals.load();
fs.writeFileSync(
'../../_radicals.md',
Object.entries(map)
.map(([k, v]) => {
const headers = [k];
if (v.meaning !== k) {
headers.push(v.meaning);
}
if (v.reading) {
headers.push(v.reading);
}
headers.push(String(v.level));
const rows = [`## ${headers.join(', ')}`, ''];
if (v.image) {
rows.push(
`<img src="${v.image.src}" alt="${k}"${
v.image.width ? ` width="${v.image.width}"` : ''
}${v.image.height ? ` height="${v.image.height}"` : ''} />`,
'',
);
}
return rows.join('\n');
})
.join('\n\n'),
);
}
if (require.main === module) {
main();
}