Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use nested lists in DAG markdown documentation #16263

Closed
Richiecakes opened this issue Jun 4, 2021 · 8 comments · Fixed by #16414
Closed

Unable to use nested lists in DAG markdown documentation #16263

Richiecakes opened this issue Jun 4, 2021 · 8 comments · Fixed by #16414
Labels
affected_version:2.0 Issues Reported for 2.0 area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug

Comments

@Richiecakes
Copy link

Richiecakes commented Jun 4, 2021

Apache Airflow version: 2.0.2

What happened:

Tried to use the following markdown as a doc_md string passed to a DAG

- Example
    -  Nested List

It was rendered in the web UI as a single list with no nesting or indentation.

What you expected to happen:

I expected the list to display as a nested list with visible indentation.

How to reproduce it:

Try and pass a DAG a doc_md string of the above nested list.
I think the bug will affect any markdown that relies on meaningful indentation (tabs or spaces)

@Richiecakes Richiecakes added the kind:bug This is a clearly a bug label Jun 4, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 4, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@Richiecakes
Copy link
Author

#14564 I suspect this pull request may be the reason since it appears to strip spaces and tabs from every line of the markdown. A minor issue, but as a lover of nested lists, would be great to get them working again 😄

@Richiecakes
Copy link
Author

airflow_issue2
airflow_issue1

This also affects code blocks, which is probably more important than nested lists, but it shows that markdown docstrings are quite limited.

textwrap.dedent could well be part of the solution here.

@Dr-Denzy
Copy link
Contributor

Dr-Denzy commented Jun 4, 2021

I will try and reproduce this.

@uranusjr
Copy link
Member

uranusjr commented Jun 4, 2021

The cause is the same as #16138 (comment). Instead of str.lstrip() each line, the parser need to dedent the lines more smartly to preserve internal indentation.

@eladkal eladkal added area:UI Related to UI/UX. For Frontend Developers. affected_version:2.0 Issues Reported for 2.0 labels Jun 7, 2021
@ashb
Copy link
Member

ashb commented Jun 11, 2021

textwrap.dedent would do the job here wouldn't it?

@uranusjr
Copy link
Member

I think so (mentioned in the linked comment), but someone needs to actually try.

@uranusjr
Copy link
Member

I tried, it works well. The linked PR fixed nested lists, but does not fix triple-tick code blocks because it’s a non-universal extension syntax. See my comments in the PR for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.0 Issues Reported for 2.0 area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants