public void AddStyle(IToken token) { _styles.Merge(token); if (token is PlainStyle && _defaultStyles?.Count > 0) { _styles.MergeRange(_defaultStyles); } }
public IEnumerable <IToken> ParagraphStyles(Document document) { var styleId = Styles.OfType <ListStyleId>().FirstOrDefault(); if (styleId == null || !document.ListStyles.TryGetValue(styleId.Value, out var listStyle)) { return(Styles .Where(t => !HtmlVisitor.IsSpanElement(t))); } var levelNum = Styles.OfType <ListLevelNumber>().FirstOrDefault() ?? new ListLevelNumber(0); var result = new StyleList(listStyle.Style.Levels[levelNum.Value] .Where(t => t.Type == TokenType.ParagraphFormat)); result.MergeRange(Styles .Where(t => !HtmlVisitor.IsSpanElement(t))); return(result); }