diff options
Diffstat (limited to 'parser/pageparser/item.go')
-rw-r--r-- | parser/pageparser/item.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/parser/pageparser/item.go b/parser/pageparser/item.go index f23341ea8..52546be41 100644 --- a/parser/pageparser/item.go +++ b/parser/pageparser/item.go @@ -18,6 +18,8 @@ import ( "fmt" "regexp" "strconv" + + "github.com/yuin/goldmark/util" ) type Item struct { @@ -64,7 +66,11 @@ func (i Item) ValTyped() any { } func (i Item) IsText() bool { - return i.Type == tText + return i.Type == tText || i.Type == tIndentation +} + +func (i Item) IsIndentation() bool { + return i.Type == tIndentation } func (i Item) IsNonWhitespace() bool { @@ -125,6 +131,8 @@ func (i Item) String() string { return "EOF" case i.Type == tError: return string(i.Val) + case i.Type == tIndentation: + return fmt.Sprintf("%s:[%s]", i.Type, util.VisualizeSpaces(i.Val)) case i.Type > tKeywordMarker: return fmt.Sprintf("<%s>", i.Val) case len(i.Val) > 50: @@ -159,6 +167,8 @@ const ( tScParam tScParamVal + tIndentation + tText // plain text // preserved for later - keywords come after this |