Skip to content

Instantly share code, notes, and snippets.

@paulirish
Last active May 15, 2025 18:36
Show Gist options
  • Save paulirish/0071c726a5b1c87f5e1d9b3a41275e3a to your computer and use it in GitHub Desktop.
Save paulirish/0071c726a5b1c87f5e1d9b3a41275e3a to your computer and use it in GitHub Desktop.
miro board export to json/markdown
// export data from miro board frames
// super specific to my usecase but should be adaptable if you're a JS person.. i'll leave the details to you
// (frame filtering, grouping and filtering items, colors into categories, etc)
// i run this in devtools snippets personally
globalThis.items = globalThis.items ?? null;
// thx https://github.com/jolle/miro-export
items = await window.miro.board.get();
// only these particular frames.
byTeam = Object.groupBy(items, o => o.type).frame.filter(f => f.title.startsWith('team'))
teamStickies = globalThis.teamStickies ?? byTeam.map(o => {
const children = o.childrenIds.map(id => items.find(i => i.id === id)).filter(i => i.type === 'sticky_note');
return {
title: o.title,
children,
};
});
lookup = {
'light_yellow': 'action',
'red': 'assumption',
'blue': 'question',
'green': 'capability',
'black': 'fork',
'orange': 'discussion',
'light_pink': 'prompt',
}
function decodeEntitiesInString(str) {
return str.replace(/&[a-zA-Z0-9#]+;/g, (entity) => {
const div = document.createElement('div');
div.innerHTML = entity;
return div.textContent;
});
}
// emits markdowny string.. if you want JSON just log/stringify `teamStickies`.
teamStickies.toReversed().map(team => {
const notes = team.children.sort((a, b) => a.createdAt.localeCompare(b.createdAt)).map(note => {
const category = lookup[note.style.fillColor] ?? 'UNKNOWN ' + note.style.fillColor;
let content = note.content.replace(/<\/?p>/g, '').replaceAll(' ', ' ').replace(/<\/?strong>/g, '** ').replaceAll('<br />', '');
content = decodeEntitiesInString(content);
return `${category.padEnd(12)} | ${content}`;
}).join('\n- ');
return `
# ${team.title}
- ${notes}`;
}).join('\n\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment