diff --git a/releasenotes/notes/support-multi-line-notes-328853d8d596fd64.yaml b/releasenotes/notes/support-multi-line-notes-328853d8d596fd64.yaml new file mode 100644 index 0000000..7c21ffb --- /dev/null +++ b/releasenotes/notes/support-multi-line-notes-328853d8d596fd64.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + Support note entries that span multiple lines using + preformatted syntax in YAML by prefixing the + list entry with ``|``. + + For example:: + + - | + This entry has two paragraphs. + + This is the second. diff --git a/reno/formatter.py b/reno/formatter.py index 6c92de7..e5193a2 100644 --- a/reno/formatter.py +++ b/reno/formatter.py @@ -28,6 +28,18 @@ _SECTION_ORDER = [ ] +def _indent_for_list(text, prefix=' '): + """Indent some text to make it work as a list entry. + + Indent all lines except the first with the prefix. + """ + lines = text.splitlines() + return '\n'.join([lines[0]] + [ + prefix + l + for l in lines[1:] + ]) + '\n' + + def format_report(reporoot, scanner_output, versions_to_include, title=None): report = [] if title: @@ -71,7 +83,7 @@ def format_report(reporoot, scanner_output, versions_to_include, title=None): report.append('-' * len(section_title)) report.append('') for n in notes: - report.append('- %s' % n) + report.append('- %s' % _indent_for_list(n)) report.append('') return '\n'.join(report)