1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Add section on line breaks to Markdown documentation, update mathematical expressions too (#53662)

Co-authored-by: Jules <19994093+jules-p@users.noreply.github.com>
This commit is contained in:
Felix Guntrip
2024-12-19 14:42:34 +00:00
committed by GitHub
parent 2cbbbe8990
commit bc192dae05
3 changed files with 42 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -199,6 +199,44 @@ Some text I want to provide a direct link to, but which doesn't have its own hea
> [!TIP]
> Custom anchors are not considered by the automatic naming and numbering behavior of automatic heading links.
## Line breaks
If you're writing in issues, pull requests, or discussions in a repository, {% data variables.product.github %} will render a line break automatically:
```markdown
This example
Will span two lines
```
However, if you are writing in an .md file, the example above would render on one line without a line break. To create a line break in an .md file, you will need to include one of the following:
* Include two spaces at the end of the first line.
<pre>
This example&nbsp;&nbsp;
Will span two lines
</pre>
* Include a backslash at the end of the first line.
```markdown
This example\
Will span two lines
```
* Include an HTML single line break tag at the end of the first line.
```markdown
This example<br/>
Will span two lines
```
If you leave a blank line between two lines, both .md files and Markdown in issues, pull requests, and discussions will render the two lines separated by the blank line:
```markdown
This example
Will have a blank line separating both lines
```
## Images
You can display an image by adding <kbd>!</kbd> and wrapping the alt text in `[ ]`. Alt text is a short text equivalent of the information in the image. Then, wrap the link for the image in parentheses `()`.

View File

@@ -42,12 +42,14 @@ This sentence uses $\` and \`$ delimiters to show math inline: $`\sqrt{3x-1}+(1+
To add a math expression as a block, start a new line and delimit the expression with two dollar symbols `$$`.
>[!TIP] If you're writing in an .md file, you will need to use specific formatting to create a line break, such as ending the line with a backslash as shown in the example below. For more information on line breaks in Markdown, see "[AUTOTITLE](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#line-breaks)."
```text
**The Cauchy-Schwarz Inequality**
**The Cauchy-Schwarz Inequality**\
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
```
![Screenshot of rendered Markdown showing how a complex equation displays on {% data variables.product.prodname_dotcom %}. The bolded text reads "The Cauchy-Schwarz Inequality". Below the text, there is an equation showing open paren the sum from k equals 1 to n of a sub k b sub k close paren squared is less than or equal to open paren the sum from k equals 1 to n of a sub k squared close paren times open paren the sum from k equals 1 to n of b sub k squared close paren.](/assets/images/help/writing/math-expression-as-a-block-rendering.png)
![Screenshot of rendered Markdown showing how a complex equation displays on {% data variables.product.prodname_dotcom %}. The bolded text reads "The Cauchy-Schwarz Inequality". Below the text, there is an equation showing the The Cauchy-Schwarz Inequality formula.](/assets/images/help/writing/math-expression-as-a-block-rendering.png)
{% ifversion math-fenced-blocks %}