Comments (4)
Right now I solved it removing html tags on php... But is there any better way to avoid markdown processing?
from grav-plugin-shortcode-core.
You can disable markdown processing at the page level with:
process:
markdown: false
You can also set it programitically on the page with:
$page->process(['markdown' => false']);
of course this would need to be set prior to the $page->content()
method being called as that's where markdown is processed if enabled.
The better option is to do some work in onPageContentRaw()
event which is called prior to processMarkdown()
function in the content()
method.
from grav-plugin-shortcode-core.
So, I think it would be interesting to see an option or function to retrieve shortcode content without formatting. Anyway I'm going to make some attemps with onPageContentRaw()
and onShortcodeHandlers
Wish me luck! ;)
from grav-plugin-shortcode-core.
Years late, but I had the same issue and figured I would share what worked OK for me:
public static function getSubscribedEvents()
{
require_once(__DIR__.'/vendor/autoload.php');
return [ 'onShortcodeHandlers' => ['onShortcodeHandlers', 0] ,
'onPageContentRaw' => ['getRaw', 0]];
}
public function getRaw(Event $e) {
$page = $e['page'];
$content = $page->content();
// <snip>
// Some simple "find my shortcode" string processing
// logic, since "$content" is just a big unparsed string at this point
// </snip>
$page->addContentMeta('customSCMeta', $scContents);
}
Later on in my extension I just check if that meta key is set. If it is set, I completely ignore the result of shortcode->getContent()
and instead use the raw contents pulled from the meta
HTH
from grav-plugin-shortcode-core.
Related Issues (20)
- CSS of shortcodes not loaded with twig, calling with markdown|shortcodes filter HOT 1
- Shortcode update creating copies of itself HOT 3
- Unexpected error message when updating v5.0.4 to v.5.0.5 HOT 6
- Shortcodes fail to render HOT 2
- Shortcodes don't work correctly with enabled Markdown Extra
- Accessing 'page' throws 404 error HOT 1
- Fontawesome icons are not displayed HOT 4
- Update Readme HOT 1
- Support 'subject' argument for safe-email shortcode
- Nested shortcodes broken in flex objects content HOT 5
- Unclear description of admin_pages_only option
- Twig variables not rendering inside html tags HOT 1
- Can't add assets after update HOT 4
- not possible to load JS assets in bottom group HOT 1
- Question: Autocomplete in Shortcode possible? HOT 1
- RegularParser fails with memory exhausted errors
- Shortcodes refer to wrong subpage when used in loop. HOT 3
- Shortcodes of subpages do not refer to the correct subpage.
- Assets not loaded when using shortcode only in Twig HOT 11
- Album icon shortcode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grav-plugin-shortcode-core.