def preview(self, lines=5): code = self.code.strip() code = code.split('\n')[:5] code = '\n'.join(code) return hilite.parse(code, self.language)
def highlighted(self): return hilite.parse(self.code, self.language, lines=True)