MCPcopy Index your code
hub / github.com/github/docs / renderPreviewNotes

Method renderPreviewNotes

src/rest/scripts/utils/operation.js:168–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 }
167
168 async renderPreviewNotes() {
169 const previews = get(this.#operation, 'x-github.previews', [])
170 this.previews = await Promise.all(
171 previews.map(async (preview) => {
172 const note = preview.note
173 // remove extra leading and trailing newlines
174 .replace(/```\n\n\n/gm, '```\n')
175 .replace(/```\n\n/gm, '```\n')
176 .replace(/\n\n\n```/gm, '\n```')
177 .replace(/\n\n```/gm, '\n```')
178
179 // convert single-backtick code snippets to fully fenced triple-backtick blocks
180 // example: This is the description.\n\n`application/vnd.github.machine-man-preview+json`
181 .replace(/\n`application/, '\n```\napplication')
182 .replace(/json`$/, 'json\n```')
183 return await renderContent(note)
184 })
185 )
186 }
187}

Callers 1

processMethod · 0.95

Calls 2

getFunction · 0.85
renderContentFunction · 0.85

Tested by

no test coverage detected