Skip to content

Commit

Permalink
Fix formatting on sandbox README
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Apr 17, 2023
1 parent 12b1422 commit cfff2e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions scripts/sandbox/templates/item.ejs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<h1><%= name %></h1>
<h1>
<%= name %>
</h1>

<p>This is project generated to serve as a reproduction starter for Storybook.</p>

<a href="<%= stackblitzUrl %>">View it in Stackblitz</a>
<a href="<%= stackblitzUrl %>">
View it in Stackblitz
</a>

<h3>Testing instructions</h3>

Expand All @@ -14,5 +18,4 @@
<p>Run Storybook:</p>
<pre>
yarn storybook
</pre>

</pre>
7 changes: 6 additions & 1 deletion scripts/sandbox/utils/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export async function renderTemplate(templatePath: string, templateData: Record<

const output = format(render(template, templateData), {
parser: 'html',
}).replace(new RegExp('</li>\\n\\n', 'g'), '</li>\n');
})
// overly complicated regex replacements to fix prettier's bad formatting
.replace(new RegExp('</li>\\n\\n', 'g'), '</li>\n')
.replace(new RegExp('<a\\n', 'g'), '<a')
.replace(new RegExp('node"\\n>', 'g'), 'node=">')
.replace(new RegExp('/\\n</a>/', 'g'), '</a>');
return output;
}

Expand Down

0 comments on commit cfff2e3

Please sign in to comment.