Shortcode gallery++ and TinyMCE editor

Hi,
For a project (I am not admin of the website) using Grav, the TinyMCE editor has been chosen for content writing.
I am using so as well, and would like to input in a page an image gallery.
The admin found the Shortcode gallery++ plugin which seems very nice.
However, this is in markdown…
My question is so: is there a way to use this plugin through the TinyMCE editor ?
Or : when writing content, is it possible to switch between TinyMCE and default Markdown editor without breaking the whole site?

Thanks a lot in advance!

@gbenj,

However, this is in markdown…
My question is so: is there a way to use this plugin through the TinyMCE editor ?

To Grav, the content of the page is just text. No matter which editor has created it. Grav will happily process the page using the Markdown library.

Unless, you have switched off Markdown processing as suggested by the TinyMCE plugin. In that case you can switch it on page by page using

process:
  markdown: true

Btw, I’m not sure if switching off Markdown processing makes such a big difference. Once a page’s content has been parsed, it will be cached for future usage.

@pamtbaau Thank you for your quick reply.

Ok, noted for the Markdown processing.

However, I’m afraid I don’t understand how to proceed…
Indeed, if I write some markdown (eg. simply ## Test for heading 2), nothing is done after saving, the text is just appearing with no formatting (and with the ‘##’)… same for a test with a table.

Am I missing something…?

If it can help, here is my page config:

title: 'My page title'
content:
    items:
        - '@self.children'
    limit: 5
    order:
        by: date
        dir: desc
    pagination: true
    url_taxonomy_filters: true
media_order: 'media1.png,media2.png,media3.png'
external_links:
    mode: active
process:
    markdown: true
    twig: true

And I don’t know if other options exist, but I am writing within the TinyMCE editor from the plugin, within my browser in the website admin part.

@gbenj,

Am I missing something…?

No, that is how the content of the page is being saved: Plain text without any parsing. No matter which editor is being used.

The magic comes when a page is being requested by the front-end. At that moment the Markdown in the content of the page is being parsed into HTML. Eg. ## title is being translated into <h2>Title</h2> and shortcode [gallery]...[/gallery] is being processed into HTML needed for the gallery. After processing the page, the result is cached for performance and reused for future requests.

Am I missing something…?

Maybe some concepts? :wink:

@pamtbaau , thanks again!
Indeed, just writing markdown in a lambda editor is the solution.
That’s why I did, locally on my computer, using the syntax of shortcode [gallery]…[/gallery] (and other direct html parts), uploaded the md file in the correct page folder on the server (I finally got access to it directly) and rendering has been as intended.
The only thing I was stuck on is that I should not write my markdown content within the TinyMCE editor (the one from this grav-plugin-tinymce-editor) in the admin panel, as this doesn’t interpret markdown. At least I didn’t manage… And didn’t manage to access any markdown editor in the admin panel neither.
Finally, just stick to a basic markdown-classic editor-uploading process (so no TinyMCE) did the job as expected!
Thanks again for the quick help provided!

@gbenj, I must correct myself a bit…

I’m not familiar with the TinyMCE Editor plugin and I expected it would be easy to insert Markdown elements. However, I just discovered that TinyMCE wraps everything inside <p> tags.

The <p> tag is a block-level HTML element and according the specs of Markdown, Markdown is not being processed inside block-level HTML elements.

A workaround could be to add markdown="1" to the HTML tag. Unfortunately, TinyMCE strips the attribute from the HTML tag… I know TinyMCE itself has the possibility to preserve custom attributes, but that’s beyond my capabilities.