@@ -112,12 +112,14 @@ newBlockTags = ["haskell","syntaxhighlight","source","gallery","references"]
112112isBlockTag' :: Tag Text -> Bool
113113isBlockTag' tag@(TagOpen t _) = (isBlockTag tag || t `elem` newBlockTags) &&
114114 t `notElem` eitherBlockOrInline
115+isBlockTag' (TagClose "ref") = True -- needed so 'special' doesn't parse it
115116isBlockTag' tag@(TagClose t) = (isBlockTag tag || t `elem` newBlockTags) &&
116117 t `notElem` eitherBlockOrInline
117118isBlockTag' tag = isBlockTag tag
118119
119120isInlineTag' :: Tag Text -> Bool
120121isInlineTag' (TagComment _) = True
122+isInlineTag' (TagClose "ref") = False -- see below inlineTag
121123isInlineTag' t = not (isBlockTag' t)
122124
123125eitherBlockOrInline :: [Text]
@@ -554,11 +556,17 @@ variable = try $ do
554556 contents <- manyTillChar anyChar (try $ string "}}}")
555557 return $ "{{{" <> contents <> "}}}"
556558
559+singleParaToPlain :: Blocks -> Blocks
560+singleParaToPlain bs =
561+ case B.toList bs of
562+ [Para ils] -> B.fromList [Plain ils]
563+ _ -> bs
564+
557565inlineTag :: PandocMonad m => MWParser m Inlines
558566inlineTag = do
559567 (tag, _) <- lookAhead $ htmlTag isInlineTag'
560568 case tag of
561− TagOpen "ref" _ -> B.note . B.plain <$> inlinesInTags "ref"
569+ TagOpen "ref" _ -> B.note . singleParaToPlain <$> blocksInTags "ref"
562570 TagOpen "nowiki" _ -> try $ do
563571 (_,raw) <- htmlTag (~== tag)
564572 if T.any (== '/') raw