MCPcopy Create free account
hub / github.com/decaporg/decap-cms / formatNoteBody

Function formatNoteBody

packages/decap-cms-lib-util/src/notesFormat.ts:41–52  ·  view source on GitHub ↗
(
  note: Pick<Note, 'content' | 'resolved'> & Partial<Pick<Note, 'author' | 'authorId'>>,
)

Source from the content-addressed store, hash-verified

39}
40
41export function formatNoteBody(
42 note: Pick<Note, 'content' | 'resolved'> & Partial<Pick<Note, 'author' | 'authorId'>>,
43) {
44 // Both or neither: a name with no id to compare against buys nothing, and a
45 // backend whose poster IS the editor records neither.
46 const identity =
47 note.authorId && note.author ? { author: note.author, authorId: note.authorId } : {};
48
49 const marker = encode({ resolved: note.resolved, ...identity });
50
51 return `${MARKER_PREFIX}${marker}${MARKER_SUFFIX}\n${note.content}`;
52}
53
54/**
55 * The marker is hand-editable on the host, so nothing in it is trusted to be

Callers 7

createIssueCommentMethod · 0.90
updateIssueCommentMethod · 0.90
API.spec.jsFile · 0.90
addNoteToEntryMethod · 0.90
updateEntryNoteMethod · 0.90
notesApi.spec.jsFile · 0.90

Calls 1

encodeFunction · 0.85

Tested by

no test coverage detected