UNPKG

@mieweb/wikigdrive

Version:

Google Drive to MarkDown synchronization

21 lines (20 loc) 865 B
import process from 'node:process'; import yaml from 'js-yaml'; import { FRONTMATTER_DUMP_OPTS } from './frontmatter.js'; export function generateConflictMarkdown(conflictFile) { 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; }