How to use raw unparsed HTML/JavaScript? #1067
Replies: 4 comments
-
|
It depends on what you want to do, JavaScript in the body is usually removed. I think you can solve this in three ways:
Give number three a try, If you want to use JavaScript with all its glory and pitfalls. Usually the Markdown parser removes unsafe HTML elements/attributes from the content, this plays a central role in making secure websites, but nothing stops you from using a different parser. It’s surprisingly simple to do that. Here's an example content file: Here's an example extension file <?php
// Html extension, experimental
class YellowHtml {
const VERSION = "0.9.1";
// Handle page content in raw format
public function onParseContentRaw($page, $text) {
return $text;
}
}Tested with Datenstrom Yellow 0.9. Hope it helps. 😄 |
Beta Was this translation helpful? Give feedback.
-
|
puhhh, i will try that sound not that complex, i just need copy that code? Is there somewhere a documentation for that? |
Beta Was this translation helpful? Give feedback.
-
|
Quick and dirty: I had a similar problem embedding JavaScript to a blog entry. I Just added a little extension to include a given JS-code snippet from the pages meta-data: A PHP-file <?php
class YellowExtrafooter
{
public const VERSION = "0.0.1";
public $yellow; // access to API
public function onParsePageExtra($page, $name) {
$output = '';
if ($name=="footer") {
if (!is_string_empty($page->get('script'))) {
$output = $page->get('script');
}
}
return $output;
}
}The blog-post could be: ---
Title: My Post
Script: <script src="/node_modules/video.js/dist/video.js"></script><script> // more js-code </script>
---
Here comes the text ...The |
Beta Was this translation helpful? Give feedback.
-
|
thanks a lot so far! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to explicit define a page as "pure" html?
I'm new to yellow and use i on openwrt router. works fine so far. site can be edited. i would like to use video.js library to show video.
the easiest way would be to have a option to manage play html code. i read some other posts about you security things. but i could be as a kind of special typ and own risk to use that...
what would be the best solution? a plugin to make sure, everything is secure?
example
`
<video id="player"
height="300"
width="600"
class="video-js vjs-big-play-centered"
controls
autoplay
loop
ish265
islive
hasvideo
hasaudio
Beta Was this translation helpful? Give feedback.
All reactions