Improve HTML rendering in Markdown and update layouts
This commit is contained in:
parent
4194154818
commit
21a77ed254
40 changed files with 282 additions and 176 deletions
|
|
@ -8,6 +8,7 @@ import { getUsernameForLang } from "../../../utils/get_username_for_lang";
|
|||
import { isAnonymousUser } from "../../../utils/is_anonymous_user";
|
||||
import { qualifyLocalURLsInMarkdown } from "../../../utils/qualify_local_urls_in_markdown";
|
||||
import { getWebsiteLinkForUser } from "../../../utils/get_website_link_for_user";
|
||||
import { toPlainMarkdown } from "../../../utils/to_plain_markdown";
|
||||
|
||||
interface ExportWebsiteInfo {
|
||||
website: PostWebsite;
|
||||
|
|
@ -86,13 +87,19 @@ export const GET: APIRoute<Props, Params> = async ({ props: { story }, site }) =
|
|||
}
|
||||
const acc = await promise;
|
||||
const newData = await qualifyLocalURLsInMarkdown(data, lang, site, exportWebsite);
|
||||
return acc ? `${acc}\n\n${newData}` : newData;
|
||||
return `${acc}\n\n${newData}`;
|
||||
}, Promise.resolve(""));
|
||||
switch (exportFormat) {
|
||||
case "bbcode":
|
||||
return { descriptionFilename: `description_${exportWebsite}.txt`, descriptionText: markdownToBbcode(storyDescription).replaceAll(/\n\n\n+/g, "\n\n") };
|
||||
return {
|
||||
descriptionFilename: `description_${exportWebsite}.txt`,
|
||||
descriptionText: markdownToBbcode(storyDescription).replaceAll(/\n\n\n+/g, "\n\n"),
|
||||
};
|
||||
case "markdown":
|
||||
return { descriptionFilename: `description_${exportWebsite}.md`, descriptionText: storyDescription.replaceAll(/\n\n\n+/g, "\n\n").trim() };
|
||||
return {
|
||||
descriptionFilename: `description_${exportWebsite}.md`,
|
||||
descriptionText: toPlainMarkdown(storyDescription).replaceAll(/\n\n\n+/g, "\n\n").trim(),
|
||||
};
|
||||
default:
|
||||
const unknown: never = exportFormat;
|
||||
throw new Error(`Unknown export format "${unknown}"`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue