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

Function showToolSpecificContent

components/article/ToolPicker.tsx:14–30  ·  view source on GitHub ↗
(tool: string, supportedTools: Array<string>)

Source from the content-addressed store, hash-verified

12// find all platform-specific *block* elements and hide or show as appropriate
13// example: {% webui %} block content {% endwebui %}
14function showToolSpecificContent(tool: string, supportedTools: Array<string>) {
15 const markdowns = Array.from(document.querySelectorAll<HTMLElement>('.extended-markdown'))
16 markdowns
17 .filter((el) => supportedTools.some((tool) => el.classList.contains(tool)))
18 .forEach((el) => {
19 el.style.display = el.classList.contains(tool) ? '' : 'none'
20 })
21
22 // find all tool-specific *inline* elements and hide or show as appropriate
23 // example: <span class="tool-webui">inline content</span>
24 const toolEls = Array.from(
25 document.querySelectorAll<HTMLElement>(supportedTools.map((tool) => `.tool-${tool}`).join(', '))
26 )
27 toolEls.forEach((el) => {
28 el.style.display = el.classList.contains(`tool-${tool}`) ? '' : 'none'
29 })
30}
31
32function getDefaultTool(defaultTool: string | undefined, detectedTools: Array<string>): string {
33 // If there is a default tool and the tool is present on this page

Callers 1

ToolPickerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected