Movatterモバイル変換


[0]ホーム

URL:


Code Fences

Published
·
Updated
·
Author
·
typora.io

Table of Contents

Basic Usage

You can clickParagraphCode Fences from the menu bar, or input``` andEnter key to insert a code block in Typora.

Syntax Highlight

When you specify a code language for the code block, Typora will highlight the code block based on the selected language.

You can modify the code language for existing code fences in the right bottom input widget of the code block. Or, when creating code fences in markdown, add the code language after```.

Screenshot 2023-05-16 at 19.55.37

Supported Code Languages

Pleasecheck here for supported code languages.

Code Actions

Copy Code Content

You can clickCtrl /Cmd +A to select the whole code block and to copy the code contents.

Or, you can clickCode ToolsCopy Code Content from the context menu, or from menubar →Paragraph to quickly copy contents inside the current code block.

Auto Indent Contents

You can auto indent a selection or the whole code block inCode Tools from the context menu or menubar.

You can also do this by pressingShift +Tab key after configuringShift + Tab Behavior.

Code Fences Options

You can find configurations about code fences underPreferences PanelMarkdownCode Fences.

Please note that these options will be applied after you restart Typora.

options

Show / Hide Line Numbers

You can control whether Typora should show line numbers for code blocks by changing the optionDisplay line numbers for code fences underPreferences PanelMarkdownCode Fences.

Show Line NumbersHide Line Numbers
Screenshot 2023-05-16 at 20.11.34Screenshot 2023-05-16 at 20.11.47

Auto Wrap Long Lines

You can control whether Typora should auto wrap lines, or provide horizontal scroll, when a code block contains text lines that are longer than the width of its code block container. You can change this option fromPreferences PanelMarkdownCode FencesAuto wrap long lines.

Wrap Long LinesNo Wrap for Long Lines
Screenshot 2023-05-16 at 20.21.20Screenshot 2023-05-16 at 20.21.26

Please note that in exported PDF or printed pages, code blocks will always be wrapped, since there’s no scrollbars for “papers”.

Shift + Tab Behavior

After version 1.5, by default,Shift +Tab andShift +[ will indent selected lines in code blocks.

You can change the optionUse Shift+Tab to auto indent selected code to let selected lines beauto indented.

Indent Size for Code

This option controls how manyTab’s are used to render the whitespace in a code block.

Default Code Language

From version 1.6, you can now set a default code language for code blocks fromPreferences PanelCode Fences.

Screenshot 2023-05-25 at 10.51.51

And Typora provides some apply options:

Auto Apply Code Language for Code Blocks inserted from menuAuto Apply Code Language for Code Blocks inserted from Markdown

You can also chooseLast Used to auto apply the last used code language when inserting new code blocks.

Code Block Styles/Themes

You can customize code block stylesfollowing this document.

Snip20160623_11


[8]ページ先頭

©2009-2025 Movatter.jp