Carriage在IPython Notebook的Markdown部分返回 [英] Carriage Returns in Markdown Section of IPython Notebook

查看:115
本文介绍了Carriage在IPython Notebook的Markdown部分返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在IPython笔记本的降价部分执行回车,以便在执行时文本保持在单独的行上(如输入时显示),而不是将所有文本合并为一个文本块?

Is there a way to execute carriage returns in a markdown section of an IPython notebook so that when executed the text remains on separate lines (as displayed when typing), rather than combining all text into a single block of text?

下面是我的输入(以及键入时的显示方式),然后是执行降价部分时的结果输出。

Below is my input (and how it displays while typing), followed by the resulting output when the markdown section is executed.

输入:

XXXX [carriage return]
YYYY [carriage return]
ZZZZ [carriage return]

输出:

XXXX YYYY ZZZZ

我可以通过输入文字来创建段落,[回车],[空格],文本,[回车](见下文),但我无法在每行文本之间的行上没有显示占位符的情况下显示连续的单行文本。

I am able to create paragraphs by typing text, [carriage return], [space], text, [carriage return] (see below), but I am unable to display consecutive individual lines of text without some placeholder on the line between each line of text.

输入:

Paragraph 1 [carriage return] [space]

Paragraph 2 [carriage return] [space]

Paragraph 3  

输出:

Paragraph 1

Paragraph 2

Paragraph 3

我错过了一些简单的事情吗?

Am I missing something easy?

推荐答案

根据 Markdown规范< br> 标签可以通过以两个或多个空格结束一行来插入:

As per the Markdown specification, <br> tags can be inserted by ending a line with two or more spaces:


段落和换行符



段落只是一个或多个连续的文本行,由一个或多个空行分隔。 (空行是任何看起来像空白行的行 - 除了空格或制表符之外的任何行都被视为空白。)正常段落不应使用空格或制表符缩进。

Paragraphs and line breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

一个或多个连续文本行规则的含义是Markdown支持硬包装文本段落。这与大多数其他文本到HTML格式化程序(包括Movable Type的转换换行符选项)显着不同,后者将段落中的每个换行符转换为< br /> tag。

The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type's "Convert Line Breaks" option) which translate every line break character in a paragraph into a <br /> tag.

如果您想使用Markdown插入< br /> 中断标记,你用两个或多个空格结束一行,然后键入return。

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

是的,这需要更多的努力才能创建一个< br /> ,但是简单的每个换行符是< br /> 规则对Markdown不起作用。当您使用硬中断格式化时,Markdown的电子邮件风格的区块报价和多段列表项目效果最好 - 看起来更好 -

Yes, this takes a tad more effort to create a <br />, but a simplistic "every line break is a <br />" rule wouldn't work for Markdown. Markdown's email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.

所以类似

XXXX␣␣
YYYY␣␣
ZZZZ

(使用表示空格)应该有效。

(using to represent spaces) should work.

这篇关于Carriage在IPython Notebook的Markdown部分返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆