File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed
src/Markdown/Parsers/InlineParsers
tests/Integration/tests/markdown/paragraph-md/input Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1111use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \InlineCodeParser ;
1212use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \InlineImageParser ;
1313use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \LinkParser ;
14+ use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \NewLineParser ;
1415use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \PlainTextParser ;
1516use phpDocumentor \Guides \Markdown \Parsers \InlineParsers \StrongParser ;
1617use phpDocumentor \Guides \Markdown \Parsers \ListBlockParser ;
7374 ->set (InlineImageParser::class)
7475 ->arg ('$inlineParsers ' , tagged_iterator ('phpdoc.guides.markdown.parser.inlineParser ' ))
7576 ->tag ('phpdoc.guides.markdown.parser.inlineParser ' )
77+ ->set (NewLineParser::class)
78+ ->tag ('phpdoc.guides.markdown.parser.inlineParser ' )
7679
7780 ->set (MarkupLanguageParser::class)
7881 ->arg ('$parsers ' , tagged_iterator ('phpdoc.guides.markdown.parser.blockParser ' ))
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * This file is part of phpDocumentor.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ *
11+ * @link https://phpdoc.org
12+ */
13+
14+ namespace phpDocumentor \Guides \Markdown \Parsers \InlineParsers ;
15+
16+ use League \CommonMark \Node \Inline \Newline ;
17+ use League \CommonMark \Node \Node as CommonMarkNode ;
18+ use League \CommonMark \Node \NodeWalker ;
19+ use League \CommonMark \Node \NodeWalkerEvent ;
20+ use phpDocumentor \Guides \MarkupLanguageParser ;
21+ use phpDocumentor \Guides \Nodes \Inline \InlineNode ;
22+ use phpDocumentor \Guides \Nodes \Inline \PlainTextInlineNode ;
23+
24+ /** @extends AbstractInlineParser<PlainTextInlineNode> */
25+ class NewLineParser extends AbstractInlineParser
26+ {
27+ public function __construct ()
28+ {
29+ }
30+
31+ public function parse (MarkupLanguageParser $ parser , NodeWalker $ walker , CommonMarkNode $ current ): InlineNode
32+ {
33+ return new PlainTextInlineNode (' ' );
34+ }
35+
36+ public function supports (NodeWalkerEvent $ event ): bool
37+ {
38+ return $ event ->isEntering () && $ event ->getNode () instanceof Newline;
39+ }
40+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments