jinja2 has a built-in `wordwrap` filter which support the definition of wrapstrings. If I understand the docs correctly you might be able to apply this filter here, like {{ cell.source | wordwrap(80, False, '\n#' * cell.level)}}
Ok, it is some rude workaround, but should be possible.