mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 03:58:32 +02:00
Pretty print titles as bold.
This commit is contained in:
parent
8615679beb
commit
af3e054b33
2 changed files with 7 additions and 2 deletions
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||
import re
|
||||
import textwrap
|
||||
from datetime import datetime
|
||||
from .util import split_title
|
||||
from .util import split_title, bold
|
||||
|
||||
|
||||
class Entry:
|
||||
|
@ -100,7 +100,7 @@ class Entry:
|
|||
return title
|
||||
else:
|
||||
return "{title}{sep}{body}\n".format(
|
||||
title=title,
|
||||
title=bold(title),
|
||||
sep="\n" if has_body else "",
|
||||
body=body if has_body else "",
|
||||
)
|
||||
|
|
|
@ -178,6 +178,11 @@ def colorize(string):
|
|||
return u"\033[36m{}\033[39m".format(string)
|
||||
|
||||
|
||||
def bold(string):
|
||||
"""Returns the string wrapped in bold ANSI escape"""
|
||||
return u"\033[1m{}\033[0m".format(string)
|
||||
|
||||
|
||||
def slugify(string):
|
||||
"""Slugifies a string.
|
||||
Based on public domain code from https://github.com/zacharyvoase/slugify
|
||||
|
|
Loading…
Add table
Reference in a new issue