Skip to content

Commit

Permalink
fix(views): render image link only when "!" specified
Browse files Browse the repository at this point in the history
  • Loading branch information
stdword committed Apr 11, 2023
1 parent d22aa51 commit 2f53eb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/mldoc_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class MldocASTtoHTMLCompiler {
let label = ''
if (data.label && data.label.length) {
const node = data.label[0]
// handle case when label is plain text: to reduce `process`` call
// handle case when label is plain text: to reduce `process` call
if (node && node.length && node[0] === 'Plain')
label = node.at(1) ?? ''
else
Expand All @@ -273,7 +273,8 @@ class MldocASTtoHTMLCompiler {
{ case 'Search': {
const term = url ?? ''
const [ protocol, link ] = resolveAssetsLink(this.context, '', term)
if (protocol)
const inclusion = data.full_text.startsWith('!')
if (inclusion && protocol)
return this.createImageLink(protocol, link, label, meta)
return this.createPageRef(term, label)
} case 'Page_ref': {
Expand Down

0 comments on commit 2f53eb2

Please sign in to comment.