Jump to content

Parsedown Extra Plugin


Mike Rockett
 Share

Recommended Posts

As I mentioned in this issue, I've create a new textformatter for ParsedownExtraPlugin, which adds some oomph to your markdown.

Repo: Parsedown Extra Plugin

Unlike the built-in textformatter for Parsedown and Parsedown Extra, this should be used when you want to use Extra with additional configuration/customisation.

Some examples:

### Test {.heading}

- A [external link](https://google.com/){.google} with `google` as a class that opens in a new tab if the config property is set.
- [Another link](/page){target=_blank} that opens in a new tab even though it isn't external.

```html .html
<p>Test</p>
```

There's some config options available to you, such as setting attributes on all/external images and links, setting table and table-cell alignment classes, adjusting footnote classes and IDs, adding <code> attributes to their parent <pre> elements, and changing the <code> class if your syntax highlighter does not use language-*.

I was thinking about adding the ability to make links open in a new tab by appending a plus to the link syntax, but only external links should be opening in a new tab anyway. Further, this would add extra, unnecessary processing time.

Please let me know if you bump into any problems. ☺️

  • Like 4
Link to comment
Share on other sites

  • 8 months later...
  • 11 months later...
  • 5 months later...
  • 3 years later...

Hi,

I am applying this text formatter to a textarea field. When I output the content of the field with

<?php $output = $page->note; ?>
<?php echo $output; ?>

in my template file, I get the following two warnings followed by the correctly formatted output.

Warning: Trying to access array offset on value of type null in /home/<domain>/public_html/site/modules/TextformatterParsedownExtraPlugin/lib/ParsedownExtra.php on line 241

Warning: Trying to access array offset on value of type null in /home/<domain>/public_html/site/modules/TextformatterParsedownExtraPlugin/lib/ParsedownExtra.php on line 241

I have Processwire 3.0.210. The version of PHP in use is 8.0.20.

The module settings are the defaults set when the module is installed, i.e. I've made no changes.

Any idea why I get these warnings?

Thanks,

Nic

Link to comment
Share on other sites

  • 2 months later...

With PHP 8.2 I get this error:

Deprecated: Use of "parent" in callables is deprecated in /**/site/modules/TextformatterParsedownExtraPlugin/lib/ParsedownExtraPlugin.php on line 94

Is this something that could be fixed in an update of the plugin? 🙂

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...