Add 'Copy as Markdown' action
Remove smart quotes from Markdown export, closes #5303
This commit is contained in:
@@ -10,6 +10,7 @@ import { Transaction } from "sequelize";
|
||||
import * as Y from "yjs";
|
||||
import textBetween from "@shared/editor/lib/textBetween";
|
||||
import { AttachmentPreset } from "@shared/types";
|
||||
import MarkdownHelper from "@shared/utils/MarkdownHelper";
|
||||
import {
|
||||
getCurrentDateAsString,
|
||||
getCurrentDateTimeAsString,
|
||||
@@ -88,13 +89,7 @@ export default class DocumentHelper {
|
||||
* @returns The document title and content as a Markdown string
|
||||
*/
|
||||
static toMarkdown(document: Document | Revision) {
|
||||
const text = document.text.replace(/\n\\\n/g, "\n\n");
|
||||
|
||||
if (document.version) {
|
||||
return `# ${document.title}\n\n${text}`;
|
||||
}
|
||||
|
||||
return text;
|
||||
return MarkdownHelper.toMarkdown(document);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -536,13 +536,8 @@ router.post(
|
||||
contentType = "text/markdown";
|
||||
content = DocumentHelper.toMarkdown(document);
|
||||
} else {
|
||||
contentType = "application/json";
|
||||
content = DocumentHelper.toMarkdown(document);
|
||||
}
|
||||
|
||||
if (contentType === "application/json") {
|
||||
ctx.body = {
|
||||
data: content,
|
||||
data: DocumentHelper.toMarkdown(document),
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user