mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-09 21:28:43 +08:00
This also adds CC-BY-4.0 to the list of accepted licenses. DISABLE_THIRD_PARTY_CHECK=update dependencies Bug: chromium:1083142 Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
48 lines
1002 B
JavaScript
48 lines
1002 B
JavaScript
'use strict'
|
|
|
|
var uri = require('../util/enclose-uri')
|
|
var title = require('../util/enclose-title')
|
|
|
|
module.exports = image
|
|
|
|
var space = ' '
|
|
var leftParenthesis = '('
|
|
var rightParenthesis = ')'
|
|
var leftSquareBracket = '['
|
|
var rightSquareBracket = ']'
|
|
var exclamationMark = '!'
|
|
|
|
// Stringify an image.
|
|
//
|
|
// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see
|
|
// `encloseTitle()`).
|
|
//
|
|
// ```markdown
|
|
// 
|
|
// ```
|
|
//
|
|
// Supports named entities in `url`, `alt`, and `title` when in
|
|
// `settings.encode` mode.
|
|
function image(node) {
|
|
var self = this
|
|
var content = uri(self.encode(node.url || '', node))
|
|
var exit = self.enterLink()
|
|
var alt = self.encode(self.escape(node.alt || '', node))
|
|
|
|
exit()
|
|
|
|
if (node.title) {
|
|
content += space + title(self.encode(node.title, node))
|
|
}
|
|
|
|
return (
|
|
exclamationMark +
|
|
leftSquareBracket +
|
|
alt +
|
|
rightSquareBracket +
|
|
leftParenthesis +
|
|
content +
|
|
rightParenthesis
|
|
)
|
|
}
|