Skip to content

Mixed ordered and unordered list hierarchies should indent consistently #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Sources/Markdown/Walker/Walkers/MarkupFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -425,21 +425,20 @@ public struct MarkupFormatter: MarkupWalker {
*/
func linePrefix(for element: Markup) -> String {
var prefix = formattingOptions.customLinePrefix
var unorderedListCount = 0
var orderedListCount = 0
var listCount = 0
for element in element.parentalChain {
if element is BlockQuote {
prefix += "> "
} else if element is UnorderedList {
if unorderedListCount > 0 {
if listCount > 0 {
prefix += " "
}
unorderedListCount += 1
listCount += 1
} else if element is OrderedList {
if orderedListCount > 0 {
if listCount > 0 {
prefix += " "
}
orderedListCount += 1
listCount += 1
} else if !(element is ListItem),
let parentListItem = element.parent as? ListItem {
/*
Expand Down