MCPcopy Create free account
hub / github.com/Devographics/Monorepo / highlightEntitiesExampleCode

Function highlightEntitiesExampleCode

api/src/load/helpers.ts:88–105  ·  view source on GitHub ↗
(entities: Entity[])

Source from the content-addressed store, hash-verified

86}
87
88export const highlightEntitiesExampleCode = async (entities: Entity[]) => {
89 for (const entity of entities) {
90 const { example } = entity
91 if (example) {
92 const { code, language } = example
93 example.codeHighlighted = code
94 if (language) {
95 try {
96 // make sure to trim any extra /n at the end
97 example.codeHighlighted = hljs.highlight(code.trim(), { language }).value
98 } catch (error) {
99 // ignore any highlighting errors
100 }
101 }
102 }
103 }
104 return entities
105}
106
107async function checkImageExists(url: string): Promise<boolean> {
108 try {

Callers 1

loadOrGetEntitiesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected