public override Node VisitMention(MentionNode mention) { var id = mention.Id.HasValue ? mention.Id.ToString() : mention.Special == SpecialMention.Everyone ? "everyone" : mention.Special == SpecialMention.Here ? "here" : throw new ArgumentOutOfRangeException("Unknown mention: " + mention.Special); _builder.Append($"<span class=\"d-mention d-user\">@{id}</span>"); return(mention); }
public Node Visit(Node node) { return(node switch { TextNode text => VisitText(text), StyleNode style => VisitStyle(style), NewlineNode nl => VisitNewline(nl), CodeNode code => VisitCode(code), LinkNode link => VisitLink(link), MentionNode mention => VisitMention(mention), ChannelNode channel => VisitChannel(channel), RoleNode role => VisitRole(role), CustomEmojiNode emoji => VisitCustomEmoji(emoji), ContainerNode container => VisitContainer(container), _ => throw new ArgumentException($"Unknown node type: {node.GetType()}."), });