0 users online. Create an account or sign in to join them.Users

Search

A new extension, "Json Formatter" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Unfortunately, this is not very well documented, but instead of adding JSON encoding directly to the CommonMark extension, you could leave the extension as is (single responsibility principle) and create a custom text formatter to combine it with your JSON formatter.

Thanks Jens for your feedback, I have updated the JSON formatter extension to include CommonMark Json. I have also added more documentation.

I have updated the JSON formatter extension to include CommonMark Json.

Not exactly what I meant...

In my opinion, formatter extensions should always do just one thing (JSON encoding in your case).

This way, developers can combine multiple of these single purpose formatters into a new custom formatter as needed. These custom formatters live in your workspace folder, not an extension, but can be reused across projects just as easily.

Some examples...

This is what your custom formatter would look like...

https://gist.github.com/jensscherbl/ffb6d11ead42840f4eb5f7c2bcfe2a06

Hoo ok! Yes i discovered that yesterday, thanks to your core archeology feedback. I thought it was easier to embed it in the extension to use it in another project but that s true your way is cleaner. In fact title case should be a separated formatter to combine with the json . Json encod options for markup is a bit different but probably works on strings too. My concern is when i start a new project i set all extensions before configuring sections, i ll have to remember i have to install the custom formatters too.

My concern is when i start a new project i set all extensions before configuring sections, i ll have to remember i have to install the custom formatters too.

I guess you could always bundle these custom formatters that are specific to your use case in a separate, private extension if that's a better fit for your workflow.

Ok, I thought this case could be useful for other users. Thanks for the gist. I removed the extension from symphonyextensions.com but didn't find how to unpublish or delete from getsymphony.com sorry.

I thought this case could be useful for other users.

It's not that it's not useful, it surely is.

But think about me adding JSON encoding to the CommonMark formatter, and then we both add HTMLPurifier to the CommonMark and the JSON formatter. We'd end up with three different formatters that all do everything and are all the same.

That's why it makes more sense to have extensions that only do one thing, and combine features as needed on a project level.

Thanks for the explanation, I understand :-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details