web: Fix inline documentation rendering (#13379)
web: Fix issues surrounding markdown rendering. - Fix issue where Mermaid diagrams do not render. - Fix link colors in dark mode. - Fix anchored links triggering router. - Fix issue where links occasionally link to missing page.
This commit is contained in:
		
							
								
								
									
										29
									
								
								web/scripts/esbuild/remark/remark-lists.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								web/scripts/esbuild/remark/remark-lists.mjs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | ||||
| /** | ||||
|  * @import {Plugin} from 'unified' | ||||
|  * @import {Root, List} from 'mdast' | ||||
|  * @import {VFile} from 'vfile' | ||||
|  */ | ||||
| import { visit } from "unist-util-visit"; | ||||
|  | ||||
| /** | ||||
|  * Remark plugin to process links | ||||
|  * @type {Plugin<[unknown], Root, VFile>} | ||||
|  */ | ||||
| export const remarkLists = () => { | ||||
|     return function transformer(tree) { | ||||
|         /** | ||||
|          * @param {List} node | ||||
|          */ | ||||
|         const visitor = (node) => { | ||||
|             node.data = node.data || {}; | ||||
|  | ||||
|             node.data.hProperties = { | ||||
|                 ...node.data.hProperties, | ||||
|                 className: "pf-c-list", | ||||
|             }; | ||||
|         }; | ||||
|  | ||||
|         // @ts-ignore - visit cannot infer the type of the visitor. | ||||
|         visit(tree, "list", visitor); | ||||
|     }; | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user
	 Teffen Ellis
					Teffen Ellis