Frage

In a Mako template, ## is intended to comment out anything that is not to appear in the output.

But in Markdown, ## means sub-heading, ### means sub-sub-heading, etc.

Now applying a Markdown filter in Mako, isn't it obvious that there is a conflict?

War es hilfreich?

Lösung

Only in the Mako template itself is ## a comment. You can still use variables (e.g., ${x}) that are strings that contain hash characters without worrying they'll be interpreted as comments.

According to Mako Syntax:

Above, the string representation of x is applied to the template’s output stream.

The variable is sent directly to the output.

It's the same concept of having hash characters in a Python string. For example:

s = "#This would be a Python comment"
print(s) # returns "#This would be a Python comment"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top