@@ -666,8 +666,6 @@ impl<'a> From<Ast> for AstNode<'a> {
666666/// Validation errors produced by [Node::validate].
667667#[ derive( Debug , Clone ) ]
668668pub enum ValidationError < ' a > {
669- /// Children were found for a node that isn't supposed to have chilrden.
670- UnexpectedChildren ( & ' a AstNode < ' a > ) ,
671669 /// The type of a child node is not allowed in the parent node. This can happen when an inline
672670 /// node is found in a block container, a block is found in an inline node, etc.
673671 InvalidChildType {
@@ -756,7 +754,16 @@ pub fn can_contain_type<'a>(node: &'a AstNode<'a>, child: &NodeValue) -> bool {
756754 | NodeValue :: Strong
757755 | NodeValue :: Link ( ..)
758756 | NodeValue :: Image ( ..)
759- | NodeValue :: WikiLink ( ..) => !child. block ( ) ,
757+ | NodeValue :: WikiLink ( ..)
758+ | NodeValue :: Strikethrough
759+ | NodeValue :: Superscript
760+ | NodeValue :: SpoileredText
761+ | NodeValue :: Underline
762+ // XXX: this is quite a hack: the EscapedTag _contains_ whatever was
763+ // possibly going to fall into the spoiler. This should be fixed in
764+ // inlines.
765+ | NodeValue :: EscapedTag ( _)
766+ => !child. block ( ) ,
760767
761768 NodeValue :: Table ( ..) => matches ! ( * child, NodeValue :: TableRow ( ..) ) ,
762769
@@ -775,22 +782,30 @@ pub fn can_contain_type<'a>(node: &'a AstNode<'a>, child: &NodeValue) -> bool {
775782 | NodeValue :: HtmlInline ( ..)
776783 | NodeValue :: Math ( ..)
777784 | NodeValue :: WikiLink ( ..)
785+ | NodeValue :: FootnoteReference ( ..)
786+ | NodeValue :: Superscript
787+ | NodeValue :: SpoileredText
788+ | NodeValue :: Underline
778789 ) ,
779790
780791 #[ cfg( feature = "shortcodes" ) ]
781792 NodeValue :: TableCell => matches ! (
782793 * child,
783794 NodeValue :: Text ( ..)
784- | NodeValue :: Code ( ..)
785- | NodeValue :: Emph
786- | NodeValue :: Strong
787- | NodeValue :: Link ( ..)
788- | NodeValue :: Image ( ..)
789- | NodeValue :: ShortCode ( ..)
790- | NodeValue :: Strikethrough
791- | NodeValue :: HtmlInline ( ..)
792- | NodeValue :: Math ( ..)
793- | NodeValue :: WikiLink ( ..)
795+ | NodeValue :: Code ( ..)
796+ | NodeValue :: Emph
797+ | NodeValue :: Strong
798+ | NodeValue :: Link ( ..)
799+ | NodeValue :: Image ( ..)
800+ | NodeValue :: Strikethrough
801+ | NodeValue :: HtmlInline ( ..)
802+ | NodeValue :: Math ( ..)
803+ | NodeValue :: WikiLink ( ..)
804+ | NodeValue :: FootnoteReference ( ..)
805+ | NodeValue :: Superscript
806+ | NodeValue :: SpoileredText
807+ | NodeValue :: Underline
808+ | NodeValue :: ShortCode ( ..)
794809 ) ,
795810
796811 NodeValue :: MultilineBlockQuote ( _) => {
0 commit comments