@mieweb/wikigdrive
Version:
Google Drive to MarkDown synchronization
28 lines (21 loc) • 901 B
text/typescript
import process from 'node:process';
import yaml from 'js-yaml';
import {ConflictFile} from '../../../model/LocalFile.ts';
import {FRONTMATTER_DUMP_OPTS} from './frontmatter.ts';
export function generateConflictMarkdown(conflictFile: ConflictFile): string {
const fmt = yaml.dump({
id: conflictFile.id,
title: conflictFile.title,
conflicting: conflictFile.conflicting,
fileName: conflictFile.fileName,
mimeType: conflictFile.mimeType,
date: conflictFile.modifiedTime,
autogenerated: true,
wikigdrive: process.env.GIT_SHA
}, FRONTMATTER_DUMP_OPTS);
const frontmatter = '---\n' + fmt + '---\n';
const mdList = conflictFile.conflicting.map(conflictingFile => {
return `* [${conflictingFile.title}](${conflictingFile.realFileName})`;
}).join('\n');
return frontmatter + 'There were two documents with the same name in the same folder:\n\n' + mdList;
}