All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
25 lines
644 B
JavaScript
25 lines
644 B
JavaScript
'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)}]
|
||
}
|
||
}
|
||
}
|