Closed ganar closed 6 years ago
Stringy doesn't have any special functions for assisting with that. Are you converting from markdown to HTML? If there's only a single level of nesting as in this example, you could convert the first h2 to <section><h2></h2>
, each subsequent to </section><section><h2></h2>
, and append a closing </section>
.
That said, it sounds like you just want a markdown parser: https://github.com/erusev/parsedown
I need to be able to find a block defined by the occurrence of an
H2
title followed by a number of html elements and ending just before the opening of followingH2
, or the end of the container, in order to add a<section>
around it. Here is an example of the markdown:The final output from
twig
should be something like this:Can Stringy help me to do that? How?
Any help on the subject is appreciated!