Creating code blocks
You can create a code block in two ways:- Type
/and select “Code Block” from the menu - Use the keyboard shortcut: Type three backticks (```) followed by Enter
Syntax highlighting
Fylepad uses Lowlight for syntax highlighting, supporting over 100 programming languages including:- Web development
- Backend languages
- Data & scripting
- Markup & config
- JavaScript / TypeScript
- HTML
- CSS / SCSS / SASS
- JSX / TSX
- Vue
- React
- Svelte
Syntax highlighting is applied automatically based on the language you specify. If no language is specified, the code is displayed without highlighting.
Language selection
To enable syntax highlighting for a specific language:- Click inside the code block
- The language selector will appear in the top-right corner
- Type the language name or select it from the dropdown
- Syntax highlighting will be applied automatically
javascriptorjstypescriptortspythonorpybashorshellhtmlcssjsonyamlmarkdownormd
Code examples
JavaScript example
Python example
TypeScript example
HTML example
CSS example
Bash example
JSON example
Inline code
For short code snippets within regular text, use inline code formatting:- Select the text you want to format as code
- Use the keyboard shortcut
Ctrl+E(Windows/Linux) orCmd+E(Mac) - Or wrap the text with single backticks: `code`
console.log() function to output text in JavaScript.
Code block features
Line wrapping
Line wrapping
Long lines of code automatically wrap in code blocks to prevent horizontal scrolling. This makes it easier to view code on smaller screens.
Monospace font
Monospace font
Code blocks use the Roboto Mono font by default, which is optimized for code readability. The font ensures proper alignment of characters.
Dark mode support
Dark mode support
Code blocks have dedicated color schemes for both light and dark modes. Syntax highlighting adapts automatically to match your theme.
Copy and paste
Copy and paste
You can copy code from code blocks while preserving formatting. Paste code from external sources directly into code blocks.
Tips for using code blocks
Always specify the language for syntax highlighting. This makes your code more readable and easier to understand.
Use consistent indentation within your code blocks. Fylepad preserves your formatting exactly as you type it.
Add comments to explain complex code. Comments help you and others understand the code’s purpose.
Keep code blocks focused. If you have multiple distinct code samples, use separate code blocks rather than combining them.
Exporting code
When you export your note as Markdown, code blocks are preserved with their language specifiers:Code block keyboard shortcuts
| Action | Shortcut |
|---|---|
| Create code block | Ctrl+Alt+C / Cmd+Option+C |
| Insert inline code | Ctrl+E / Cmd+E |
| Exit code block | Escape (when at start or end) |
| Create new line | Enter |
| Indent line | Tab |
| Outdent line | Shift+Tab |