fix: last paragraph disappearing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bba5926af4
commit
85ae5f4e94
@ -6,6 +6,7 @@ import stringify from "rehype-stringify";
|
|||||||
import { visit } from 'unist-util-visit'
|
import { visit } from 'unist-util-visit'
|
||||||
import { fromSelector } from 'hast-util-from-selector';
|
import { fromSelector } from 'hast-util-from-selector';
|
||||||
import { generateSizesString, generateSrcsetString } from "./srcset";
|
import { generateSizesString, generateSrcsetString } from "./srcset";
|
||||||
|
import type { Nullable } from "@tryghost/content-api";
|
||||||
|
|
||||||
const sizes = [300, 600, 1000, 1500, 2000];
|
const sizes = [300, 600, 1000, 1500, 2000];
|
||||||
|
|
||||||
@ -59,7 +60,8 @@ export const postProcessor: Plugin = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const processPostHtml = async (postHtml: string) => {
|
export const processPostHtml = async (postHtml?: Nullable<string>) => {
|
||||||
|
if (postHtml) {
|
||||||
const processor = unified()
|
const processor = unified()
|
||||||
.use(parse)
|
.use(parse)
|
||||||
.use(postProcessor)
|
.use(postProcessor)
|
||||||
@ -67,4 +69,7 @@ export const processPostHtml = async (postHtml: string) => {
|
|||||||
|
|
||||||
const result = await processor.process(postHtml);
|
const result = await processor.process(postHtml);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
}
|
||||||
|
return "Unable to process post";
|
||||||
|
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
error: new Error('Post not found')
|
error: new Error('Post not found')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const newHtml = await processPostHtml(post.html ?? '');
|
const newHtml = await processPostHtml(post.html);
|
||||||
post.html = newHtml;
|
post.html = newHtml;
|
||||||
const prevPost = await browsePrevPost(post);
|
const prevPost = await browsePrevPost(post);
|
||||||
const nextPost = await browseNextPost(post);
|
const nextPost = await browseNextPost(post);
|
||||||
@ -77,6 +77,8 @@
|
|||||||
<PostMain>
|
<PostMain>
|
||||||
<GhostStyle>
|
<GhostStyle>
|
||||||
{@html post.html}
|
{@html post.html}
|
||||||
|
|
||||||
|
<br/>
|
||||||
</GhostStyle>
|
</GhostStyle>
|
||||||
<svelte:fragment slot="comments" />
|
<svelte:fragment slot="comments" />
|
||||||
</PostMain>
|
</PostMain>
|
||||||
|
Loading…
Reference in New Issue
Block a user