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/03/02 15:23:37 UTC
[GitHub] [airflow] XD-DENG opened a new pull request #14564: BugFix: fix DAG doc display (especially for TaskFlow DAGs)
XD-DENG opened a new pull request #14564:
URL: https://github.com/apache/airflow/pull/14564
### Issue and Background
Let's take the example DAG `tutorial_taskflow_api_etl` as example. In **2.0.1**, the DAG doc in Markdown format is not rendered properly.

If it's rendered properly, it should look like the DAG Docs of another example DAG, `tutorial`,

### Why
Because of how TaskFlow DAGs are constructed, their `__doc__` lines may start with spaces. This fails `markdown.markdown()`, and the doc in Markdown format cannot be transformed into HTML properly, and further fails the doc display in the UI.
Actually this also affects the non-TaskFlow DAGs (if users accidentally add a space in the beginning of any line in the `__doc__`)
```python
def x(x):
"""
### Header
XD's test
2nd line
"""
return x * 2
import markdown
print('Case-1')
print(markdown.markdown(x.__doc__))
print('Case-2')
print(markdown.markdown('\n'.join(line.lstrip() for line in x.__doc__.split('\n'))))
```
Output:
```
Case-1
<pre><code>### Header
XD's test
2nd line
</code></pre>
Case-2
<h3>Header</h3>
<p>XD's test
2nd line</p>
```
### Solution
This commit fixes this by always doing left strip for each line for the doc md.
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
----------------------------------------------------------------
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
[GitHub] [airflow] Richiecakes commented on pull request #14564: BugFix: fix DAG doc display (especially for TaskFlow DAGs)
Posted by GitBox <gi...@apache.org>.
Richiecakes commented on pull request #14564:
URL: https://github.com/apache/airflow/pull/14564#issuecomment-854366073
I believe this commit prevents the use of e.g nested lists in markdown docs where indentation is important. Does whitespace/tabs need to be stripped from every line of all markdown docstrings?
--
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
[GitHub] [airflow] Richiecakes commented on pull request #14564: BugFix: fix DAG doc display (especially for TaskFlow DAGs)
Posted by GitBox <gi...@apache.org>.
Richiecakes commented on pull request #14564:
URL: https://github.com/apache/airflow/pull/14564#issuecomment-854366073
I believe this commit prevents the use of e.g nested lists in markdown docs where indentation is important. Does whitespace/tabs need to be stripped from every line of all markdown docstrings?
--
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
[GitHub] [airflow] kaxil merged pull request #14564: BugFix: fix DAG doc display (especially for TaskFlow DAGs)
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #14564:
URL: https://github.com/apache/airflow/pull/14564
----------------------------------------------------------------
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
[GitHub] [airflow] github-actions[bot] commented on pull request #14564: BugFix: fix DAG doc display (especially for TaskFlow DAGs)
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14564:
URL: https://github.com/apache/airflow/pull/14564#issuecomment-789229489
[The Workflow run](https://github.com/apache/airflow/actions/runs/615424920) is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason.
----------------------------------------------------------------
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