-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Markdown Command displays "error" notification everytime Settings are modified. #107
Comments
Can you install the latest version of the app? Can you also copy the command from Command dialog (F6 shortcut) and paste here for reference? |
I'm on v9.1.0 already. copyq:
const markdownTag = 'markdown'
const mimeTags = 'application/x-copyq-tags'
const tagFragments = ['@']
const textFragments = [
'`',
'\n##',
'](',
'\n* ',
]
const errorLabel = 'Markdown Error'
function contains(text, what) {
return text.indexOf(what) != -1
}
function startsWith(text, what) {
return what === text.substring(0, what.length)
}
function matchesAnyOf(text, fragments) {
return fragments.find(e => text.indexOf(e) != -1)
}
function addHtml(html, tag) {
setData(mimeHtml, html)
if (tag) {
tags = data(mimeTags)
tags = (tags ? str(tags) + ',' : '') + tag
setData(mimeTags, tags)
}
return true
}
function addHtmlOutput(result, tag) {
if (!result) {
notification(
'.id', 'highlight',
'.message', 'Failed to add syntax highlighting',
)
return false
}
if (result.exit_code !== 0) {
popup(errorLabel, result.stderr)
return false
}
return addHtml(result.stdout, tag)
}
function markdown(textData) {
result = execute('marked', null, textData)
return addHtmlOutput(result, markdownTag)
}
function highlightCode() {
var formats = dataFormats()
if ( formats.indexOf(mimeHidden) != -1
|| formats.indexOf(mimeHtml) != -1 ) {
return false
}
var textData = data(mimeText)
var text = str(textData)
if (!text)
return false
tags = str(data(mimeTags))
try {
if ( startsWith(text, 'http') )
return markdown(textData, 'md')
if ( matchesAnyOf(tags, tagFragments)
|| matchesAnyOf(text, textFragments) ) {
return markdown(textData)
}
} catch(e) {
popup(errorLabel, e)
serverLog(errorLabel + ': ' + e)
}
return false
}
highlightCode() |
Can you copy the whole command from the command list or with the Copy Selected button? The code should be in ini format starting with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the
convert markdown
command (part of the 'standard library' -- in this repo) imported into CopyQ and enabled. Whenever I modify settings in the CopyQ app (completely unrelated to this command), as soon as I click Apply, CopyQ displays the following notification:Not sure why, but it definitely seems like a bug (either in the program or in the command). I imported the command from this repository unmodified. And as you can see from the screenshot, it could be anything in Settings that I modify, e.g. the application's appearance/theme. Regardless of what it is, as soon as I click Apply, I get that
Markdown Error
alert.The text was updated successfully, but these errors were encountered: