Comments (9)
I presume this is because the <iframe>
is sanitized away. Have you configured the sanitizer in your Markdown parser to support iframes?
from woofmark.
I need this myself, and this is possible by configuring sanitizers in megamark
, which is often paired with woofmark
as a markdown parser: https://github.com/bevacqua/megamark#optionssanitizer
These are then passed to insane
(https://github.com/bevacqua/insane), but the format for megamark
is:
megamark('**foo**', {
allowedTags: ['iframe']
});
I'm testing this out in a moment in PublicLab.Editor
, which uses woofmark
. I'll update here if it works with a link to a code example.
from woofmark.
This worked. I'll share code shortly but now we also need to allow iframe
on the HTML parser, which for me is domador
. Perhaps it's the allowFrame
setting?
https://github.com/bevacqua/domador#allowframe
from woofmark.
Hm, I'm not able to get that to work, passing a function to allowFrame
that returns true
. Trying just the value true
now. Also noting that woofmark
(on my local, so possibly needs update) uses domador
v2.4.2
and allowFrame
was added in v2.2.0
so we should be OK.
from woofmark.
Still not working. I'll create an issue on domador
to find out more.
from woofmark.
Posted at bevacqua/domador#10 -- any help appreciated! Thanks :-)
from woofmark.
Relaying back; @bevacqua sez:
Thus, the issue is probably in that you're allowing frames on domador but then woofmark isn't configured to support YouTube iframes at the sanitizer level, and then they are stripped out. That would be my guess.
Looking into sanitizing code/config in woofmark
now, to check this idea out.
from woofmark.
I'm having some success adding to the transform
function:
transform: function (el) {
if (el.tagName === 'IFRAME') {
return '\n\n' + el.outerHTML;
}
}
This seems to work.
from woofmark.
OK, posting solution in publiclab/PublicLab.Editor#107; this is possible via configuration, although it's about ~20 lines of code due to having to rewrite the allowedTags
and allowedAttributes
defaults.
from woofmark.
Related Issues (20)
- Provide strikethrough function HOT 1
- Provide tick list function HOT 1
- Switching between WYSIWYG and Markdown mode breaks formating HOT 1
- A more complete example? HOT 3
- Ability to change the position of the controls HOT 1
- Selecting a bit of text and then pressing bold, italic, bold, ruins the selection.
- When creating a list, selecting bold (or italic) when no text has been written yet causes the list to break.
- Config option for non-footnoted image markdown: ![a.jpg](/a.jpg)
- Buttons above the wysiwyg-container? HOT 1
- Translations
- Use start= attribute of <ol> to enable numbered lists that start with non-1 digits HOT 3
- need for mergeHtmlAndAttachment in markdown resolved() method? HOT 3
- Event fire as user inputs HOT 1
- ability to intercept Base64 dataURL images before upload (server overload) HOT 2
- Uncaught Error: woofmark demands <textarea> elements to have no siblings HOT 2
- Entering a link scrolls the page to the start of the textarea
- Inserting headings h2, h3 HOT 1
- woofmark excludes the textarea from being sent back on form post HOT 3
- Cursor may move, select text or insert garbage when switching from markdown to HTML/wysiwyg HOT 2
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.