MCPcopy
hub / github.com/github/docs / _render

Method _render

lib/page.js:168–265  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

166 }
167
168 async _render(context) {
169 // use English IDs/anchors for translated headings, so links don't break (see #8572)
170 if (this.languageCode !== 'en') {
171 const englishHeadings = getEnglishHeadings(this, context)
172 context.englishHeadings = englishHeadings
173 }
174
175 this.intro = await renderContentWithFallback(this, 'rawIntro', context)
176 this.introPlainText = await renderContentWithFallback(this, 'rawIntro', context, {
177 textOnly: true,
178 })
179 this.title = await renderContentWithFallback(this, 'rawTitle', context, {
180 textOnly: true,
181 })
182
183 const html = await renderContentWithFallback(this, 'markdown', context)
184
185 // Adding communityRedirect for Discussions, Sponsors, and Codespaces - request from Product
186 if (
187 this.parentProduct &&
188 (this.parentProduct.id === 'discussions' ||
189 this.parentProduct.id === 'sponsors' ||
190 this.parentProduct.id === 'codespaces')
191 ) {
192 this.communityRedirect = {
193 name: 'Provide GitHub Feedback',
194 href: `https://github.com/community/community/discussions/categories/${this.parentProduct.id}`,
195 }
196 }
197
198 // product frontmatter may contain liquid
199 if (this.rawProduct) {
200 this.product = await renderContentWithFallback(this, 'rawProduct', context)
201 }
202
203 // permissions frontmatter may contain liquid
204 if (this.rawPermissions) {
205 this.permissions = await renderContentWithFallback(this, 'rawPermissions', context)
206 }
207
208 // Learning tracks may contain Liquid and need to have versioning processed.
209 if (this.rawLearningTracks) {
210 const { featuredTrack, learningTracks } = await processLearningTracks(
211 this.rawLearningTracks,
212 context
213 )
214 this.featuredTrack = featuredTrack
215 this.learningTracks = learningTracks
216 }
217
218 // introLinks may contain Liquid and need to have versioning processed.
219 if (this.rawIntroLinks) {
220 const introLinks = {}
221 for (const [rawKey, value] of Object.entries(this.rawIntroLinks)) {
222 introLinks[rawKey] = await renderContent(value, context, {
223 textOnly: true,
224 })
225 }

Callers

nothing calls this directly

Calls 4

getEnglishHeadingsFunction · 0.85
processLearningTracksFunction · 0.85
renderContentFunction · 0.85

Tested by

no test coverage detected