Escape or change comments format

68 views
Skip to first unread message

Juan A. S.

unread,
Aug 12, 2016, 4:17:57 AM8/12/16
to Mako Templates for Python
Hi

I have created a script that takes files, with Markdown and Mako sentences. First, I render the template in mako, and then in Markdown. For example:

## Level 2 Title

% for i in [1, 2, 3]:
### Level 3 Title - ${i}
% endfor

The problem is that mako thinks that the lines starting with "##" are comments, when they are titles really. I know I can escape it with <%text>, but, is there any way to change the comment tag in mako? If not, I would have to change all the comment tags in the markdown files, and it would be more difficult to read.

Thanks in advance.

mike bayer

unread,
Aug 12, 2016, 10:08:18 AM8/12/16
to mako-d...@googlegroups.com
Mako is not that extensible but you can add a preprocessor that
search-and-replaces for "##" lines and puts the <%text> around them.
> --
> You received this message because you are subscribed to the Google
> Groups "Mako Templates for Python" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mako-discuss...@googlegroups.com
> <mailto:mako-discuss...@googlegroups.com>.
> To post to this group, send email to mako-d...@googlegroups.com
> <mailto:mako-d...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/mako-discuss.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages