You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/31 11:12:14 UTC
[GitHub] [airflow] sweco commented on issue #16138: doc_md code block collapsing lines
sweco commented on issue #16138:
URL: https://github.com/apache/airflow/issues/16138#issuecomment-851416191
Hey @Dr-Denzy, thank you for looking into this, but I believe that what you managed to produce are not multi-line code blocks but rather:
- In the first case just regular paragraphs
- In the second case, regular paragraphs each with inline (one-line) code
If I'm right, these are not code blocks. According to the Markdown Guide, you can create a code block in two ways: [classic code block](https://www.markdownguide.org/basic-syntax/#code-blocks) and [fenced code block](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks).
### Classic code block
A classic code block is created by indenting a block by 4 spaces (Bitbucket requires this to be 8 spaces), but it does not seem to work with either 4 or 8 spaces.
```python
DOC_MC = """\
# Markdown code block
Inline `code` works well.
Code block
does not
respect
newlines
"""
```
Normally this would look as in the Markdown guide, but Airflow just creates a normal paragraph.
<img width="40%" src="https://user-images.githubusercontent.com/11132999/120184077-d7293780-c210-11eb-9505-e43a9c8a64db.png" />
### Fenced code block
Created by delimiting the code block by three backticks (that's what I used in the first example):
````python
DOC_MC = """\
# Markdown code block
Inline `code` works well.
```
Code block
does not
respect
newlines
```
"""
````
This creates a `code` element in the HTML DOM but it joins the lines:
<img width="40%" src="https://user-images.githubusercontent.com/11132999/120184471-50288f00-c211-11eb-86b2-92bc53dcf076.png" />
<img width="40%" src="https://user-images.githubusercontent.com/11132999/120184765-a39add00-c211-11eb-8c9a-e63b818842d8.png" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org