Skip to content

Commit

Permalink
Make tables look less busted
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Johnston committed Oct 12, 2023
1 parent 3dcef5d commit b0d3549
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions blog-app/src/app/services/contentful.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { environment } from 'src/environments/environment';
import { CfPost } from '../contentful-model/post';
import { CfPage } from '../contentful-model/page';
import { documentToHtmlString } from '@contentful/rich-text-html-renderer';
import { Document, MARKS } from "@contentful/rich-text-types";
import { BLOCKS, Document, MARKS } from "@contentful/rich-text-types";

@Injectable({
providedIn: 'root'
Expand All @@ -19,8 +19,10 @@ export class ContentfulService implements IContentService {

private renderOptions = {
renderNode: {
'embedded-asset-block': (node: any) =>
`<img class="img-fluid" src="${node.data.target.fields.file.url}"/>`
[BLOCKS.EMBEDDED_ASSET]: (node: any) =>
`<img class="img-fluid" src="${node.data.target.fields.file.url}"/>`,
[BLOCKS.TABLE]: (node: any, next: any) =>
`<table class="table">${next(node.content)}</table>`
},
renderMark: {
[MARKS.CODE]: (text: any) => `<p><code><pre>${text}</pre></code></p>`
Expand Down

0 comments on commit b0d3549

Please sign in to comment.