File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
apify-docs-theme/src/theme/Layout
src/components/LLMButtons Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,19 @@ export default function LayoutWrapper(props) {
1010 const { options : { subNavbar } } = usePluginData ( '@apify/docs-theme' ) ;
1111 const baseUrl = useBaseUrl ( '/' ) ;
1212 const currentPath = useLocation ( ) . pathname . replace ( new RegExp ( `^${ baseUrl } ` ) , '' ) ;
13+ const isMarkdownView = currentPath . endsWith ( '.md' ) ;
14+
15+ // Add data attribute to HTML element when on markdown view
16+ React . useEffect ( ( ) => {
17+ if ( typeof document !== 'undefined' ) {
18+ const htmlElement = document . documentElement ;
19+ if ( isMarkdownView ) {
20+ htmlElement . setAttribute ( 'data-markdown-view' , 'true' ) ;
21+ } else {
22+ htmlElement . removeAttribute ( 'data-markdown-view' ) ;
23+ }
24+ }
25+ } , [ isMarkdownView ] ) ;
1326
1427 return (
1528 < >
Original file line number Diff line number Diff line change 1- import { useLocation } from '@docusaurus/router' ;
21import React from 'react' ;
32
43import CopyForLLM from './CopyForLLM' ;
54import styles from './styles.module.css' ;
65import ViewAsMarkdown from './ViewAsMarkdown' ;
76
87export default function LLMButtons ( ) {
9- const location = useLocation ( ) ;
10-
11- // Don't render LLMButtons if we're on a markdown view
12- if ( location . pathname . endsWith ( '.md' ) ) {
13- return null ;
14- }
15-
168 return (
179 < div className = { styles . llmButtonsContainer } >
1810 < ViewAsMarkdown />
Original file line number Diff line number Diff line change 66 margin-bottom : calc (var (--ifm-h1-vertical-rhythm-bottom ) * var (--ifm-leading ));
77}
88
9+ /* Hide LLMButtons on markdown pages (URLs ending with .md) */
10+ html [data-markdown-view = "true" ] .llmButtonsContainer {
11+ display : none !important ;
12+ }
13+
914.llmButtonsSeparator {
1015 width : 1px ;
1116 height : 16px ;
You can’t perform that action at this time.
0 commit comments