bernhard Posted May 20, 2020 Share Posted May 20, 2020 $format = $modules->get("TextformatterMarkdownExtra"); $format->format($str); echo $str; 5 Link to comment Share on other sites More sharing options...
kongondo Posted May 20, 2020 Share Posted May 20, 2020 Nice one, thanks! When I saw the post title, being in Tuts, I was expecting one of your long posts ?. This works fine though; simple and to the point! 1 Link to comment Share on other sites More sharing options...
Pixrael Posted May 20, 2020 Share Posted May 20, 2020 Oh! ... put it here: https://processwire-recipes.com/about/contribute/ Link to comment Share on other sites More sharing options...
bernhard Posted May 20, 2020 Author Share Posted May 20, 2020 4 hours ago, Pixrael said: Oh! ... put it here: https://processwire-recipes.com/about/contribute/ I think I have never ever used any of the recipes - if anybody uses that as source of such snippets feel free to post it there. My screenshot is licensed under MIT ? Link to comment Share on other sites More sharing options...
Robin S Posted May 20, 2020 Share Posted May 20, 2020 You can also use $sanitizer->entitiesMarkdown(), either for basic markdown or full markdown by setting the options argument to true. 3 Link to comment Share on other sites More sharing options...
SwimToWin Posted January 24, 2021 Share Posted January 24, 2021 @bernhard - Where does d() come from? In my ProcessWire 3.0.165 (production) I get: $str = "| Entry | | Foo |"; $md = $modules->get('TextformatterMarkdownExtra'); $md->format($str); d($str); // Fatal Error: Uncaught Error: Call to undefined function d() // Same for: d('foo'); Link to comment Share on other sites More sharing options...
bernhard Posted January 24, 2021 Author Share Posted January 24, 2021 d() is the dumping feature of Tracy Debugger ? Use it in the tracy console code panel and you'll be a lot faster with such quick php snippet tests/creations ? 1 Link to comment Share on other sites More sharing options...
ErikMH Posted July 18, 2021 Share Posted July 18, 2021 This textformatter seems to work for really simple Markdown things like emphasis and headers. But I get Trying to access array offset on value of type null errors if I do any of the following: create an unordered list by beginning successive lines with `- ` feed it text that contains a bracket character (`[`) that’s not being used as part of a link put a short string of `-` characters on a line of its own to generate a horizontal rule Interestingly, if I try to create an unordered list by beginning successive lines with `• ` instead of `- ` (both are acceptable Markdown syntaxes), the attempt is just ignored: no formatting is done and no error occurs. Also interestingly, ordered lists work as expected! Are others encountering these problems? I really want to be able to parse Markdown. I’d love for extended things like footnotes and tables to be supported, but I’d settle for Gruber’s original bare-bone syntax. Link to comment Share on other sites More sharing options...
Robin S Posted July 19, 2021 Share Posted July 19, 2021 14 hours ago, ErikMH said: But I get Trying to access array offset on value of type null errors if I do any of the following: create an unordered list by beginning successive lines with `- ` feed it text that contains a bracket character (`[`) that’s not being used as part of a link put a short string of `-` characters on a line of its own to generate a horizontal rule It's working for me. I'm using PHP 7.3 so if you are using a newer version then it could be that the included Parsedown library needs an update. If you trace it back to being related to PHP version then please open a GitHub issue because TextformatterMarkdownExtra is a core module. 2 Link to comment Share on other sites More sharing options...
ErikMH Posted July 19, 2021 Share Posted July 19, 2021 Wow — not what I see at all. Thanks for testing, @Robin S! I’ll look further into this and report back. I’m using PHP 7.4, btw. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now