Skip to content

Commit

Permalink
fix snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz authored Dec 1, 2024
1 parent be686f7 commit b5be608
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,7 @@ export function buildAdventOfTheDay(options: Options) {
`Unable to parse the snippet for the advent of code properly, original source code being:\n\n${JSON.stringify(originalSource)}`,
);
}
const snippetLinesWithHeadingSpaces = m[2].split('\n');
const spacesCountToDrop = /^( +)/.exec(snippetLinesWithHeadingSpaces[0])?.[1].length ?? 0;
const spacesToDrop = ' '.repeat(spacesCountToDrop);
const snippet = snippetLinesWithHeadingSpaces
.map((line) => (line.startsWith(spacesToDrop) ? line.substring(spacesToDrop.length) : line))
.map((line) => line.replace(/^return /, 'export default '))
.join('\n');

const snippet = m[2].replace(/return /, 'export default ');
function AdventPlaygroundOfTheDay() {
return (
<AdventPlayground
Expand Down

0 comments on commit b5be608

Please sign in to comment.