We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9bb1d88 + 4ac632e commit 5523d80Copy full SHA for 5523d80
1 file changed
src/components/InteractivePython/index.js
@@ -9,7 +9,14 @@ export default function InteractivePython({ children }) {
9
const { siteConfig } = useDocusaurusContext();
10
const baseUrl = siteConfig.baseUrl;
11
12
- const initialCode = children?.props?.children?.trim() || '';
+ const rawCode = children?.props?.children?.trim() || '';
13
+ const lines = rawCode.split('\n').length;
14
+ const minLines = 5;
15
+
16
+ const initialCode =
17
+ lines < minLines
18
+ ? rawCode + '\n'.repeat(minLines - lines)
19
+ : rawCode;
20
const [code, setCode] = useState(initialCode);
21
const [isRunning, setIsRunning] = useState(false);
22
0 commit comments