This commit is contained in:
24
node_modules/hast-util-to-mdast/lib/handlers/iframe.js
generated
vendored
Normal file
24
node_modules/hast-util-to-mdast/lib/handlers/iframe.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = iframe
|
||||
|
||||
var resolve = require('../util/resolve')
|
||||
var wrapText = require('../util/wrap-text')
|
||||
|
||||
function iframe(h, node) {
|
||||
var src = node.properties.src
|
||||
var title = node.properties.title
|
||||
|
||||
// Only create a link if there is a title.
|
||||
// We can’t use the content of the frame because conforming HTML parsers treat
|
||||
// it as text, whereas legacy parsers treat it as HTML, so it will likely
|
||||
// contain tags that will show up in text.
|
||||
if (src && title) {
|
||||
return {
|
||||
type: 'link',
|
||||
title: null,
|
||||
url: resolve(h, src),
|
||||
children: [{type: 'text', value: wrapText(h, title)}]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user