Skip to content

Commit 9032706

Browse files
committed
fix: remove inline styles
1 parent b775b7a commit 9032706

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

apps/next-blog/src/app/[post]/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export async function generateStaticParams() {
4040

4141
export default async function Post({ params }: { params: { post: string } }) {
4242
const { isEnabled } = draftMode()
43-
console.log({ isEnabled })
4443

4544
const { post: slug } = params
4645
const posts = (await getAllPosts(isEnabled)) ?? []
@@ -59,7 +58,6 @@ export default async function Post({ params }: { params: { post: string } }) {
5958
notFound()
6059
}
6160

62-
console.log(new Date().toISOString(), `Generating post ${post?.title}`)
6361
return (
6462
<SinglePost latest={latest} prev={prev} next={next} post={{ ...post, image: post.image }} />
6563
)

apps/next-blog/src/app/components/blog/SinglePost.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export async function SinglePost(props: Props) {
3131
.replace(/<\!--.*?-->/g, '')
3232
.replace(/<p>&nbsp;<\/p>/g, '')
3333
.replace(/&nbsp;/g, ' ')
34+
// get rid of all inline styles
35+
// this is not very safe
36+
.replace(/(<\w{1,3} )style=".*?"/g, '$1')
3437
// only one h1
3538
.replace(/(<\/)?h1/g, '$1h2')
3639
// give h2 and h3 tags ids so the table of contents can link to them

0 commit comments

Comments
 (0)