francescomucio commented on code in PR #25509:
URL: https://github.com/apache/airflow/pull/25509#discussion_r937690359


##########
airflow/models/dag.py:
##########
@@ -522,7 +522,7 @@ def __init__(
         self.has_on_success_callback = self.on_success_callback is not None
         self.has_on_failure_callback = self.on_failure_callback is not None
 
-        self.doc_md = doc_md
+        self.doc_md = pathlib.Path(doc_md).read_text() if 
pathlib.Path(str(doc_md or '')).is_file() else doc_md

Review Comment:
   I figured out how to render the `.md` file as a Jinja template.
   
   Unfortunately the `doc_md` template at DAG level cannot access Airflow 
macros because there is no  context (like for the templated fields for tasks). 
As mentioned 
[here](https://github.com/apache/airflow/discussions/25396#discussioncomment-3280373).
   
   Of course a macro like `{{ ds }}` has no meaning at DAG level, but accessing 
Airflow Variables or Connection could be useful.
   
   If anyone has an idea on how to add the context, I can try to do it :)



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to