Download app/scripts/notion-importer/custom-code-renderer.mjs from lerobot/robot-learning-tutorial: direct link, hf CLI and curl.
- Browser
- Download file 994 Bytes
-
https://huggingface.co/spaces/lerobot/robot-learning-tutorial/resolve/refs%2Fpr%2F3/app/scripts/notion-importer/custom-code-renderer.mjs
- Command line
-
hf download hf://spaces/lerobot/robot-learning-tutorial@refs/pr/3/app/scripts/notion-importer/custom-code-renderer.mjs
-
curl -L -o custom-code-renderer.mjs https://huggingface.co/spaces/lerobot/robot-learning-tutorial/resolve/refs%2Fpr%2F3/app/scripts/notion-importer/custom-code-renderer.mjs
994 Bytes
| /** | |
| * Custom Code Block Renderer for notion-to-md | |
| * Fixes the issue where code blocks end with "text" instead of proper closing | |
| */ | |
| export function createCustomCodeRenderer() { | |
| return { | |
| name: 'custom-code-renderer', | |
| type: 'renderer', | |
| /** | |
| * Custom renderer for code blocks | |
| * @param {Object} block - Notion code block | |
| * @returns {string} - Properly formatted markdown code block | |
| */ | |
| code: (block) => { | |
| const { language, rich_text } = block.code; | |
| // Extract the actual code content from rich_text | |
| const codeContent = rich_text | |
| .map(text => text.plain_text) | |
| .join(''); | |
| // Determine the language (default to empty string if not specified) | |
| const lang = language || ''; | |
| // Return properly formatted markdown code block | |
| return `\`\`\`${lang}\n${codeContent}\n\`\`\``; | |
| } | |
| }; | |
| } | |