Skip to content
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

Markdown-it parser not showing images in preview #77

Open
kc853 opened this issue Feb 26, 2020 · 7 comments
Open

Markdown-it parser not showing images in preview #77

kc853 opened this issue Feb 26, 2020 · 7 comments

Comments

@kc853
Copy link

kc853 commented Feb 26, 2020

Hello, just tried the Markdown-it script and the preview doesn't show the images
anymore.

Expected behaviour

Markdown-it parser shows images as the default parser

Actual behaviour

Default parser shows images in preview, Markdown-it does not.
The HTML Export shows the image.

Steps to reproduce

Create note with
![Bild](https://www.servernoobs.com/wp-content/uploads/2012/01/Linux-3.jpg)
and activate/deactivate Markdown-it script

Output from the debug section in the settings dialog

Version**: 20.2.11
Build date: Feb 26 2020
Build number: 5419
Platform: windows
Operating System: Windows 10 (10.0)
Build architecture: i386
Current architecture: x86_64
Release: AppVeyor
Qt Version (build): 5.13.2
Qt Version (runtime): 5.13.2
Portable mode: no
Settings path / key: \HKEY_CURRENT_USER\Software\PBE\QOwnNotes
Application database path: C:\Users\Normal\AppData\Roaming\PBE\QOwnNotes\QOwnNotes.sqlite
Application arguments: C:\Users\Normal\Desktop\QownNotes\QOwnNotes.exe
Qt Debug: 0
Locale (system): de_DE
Locale (interface): empty
Primary screen resolution: 1920x1080
Icon theme: breeze-dark-qownnotes
Notes in current note folder: 26
Calendar items: 0
Enabled scripts: 2

Enabled scripts

Script Merge selected notes

id: 1
path: C:\Users\Normal\AppData\Roaming\PBE\QOwnNotes\scripts\merge-notes\merge-notes.qml
variablesJson:

{
    "pyCommand": "C:\\Users\\Normal\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe"
}

identifier: merge-notes
version: 0.0.3
minAppVersion: 17.08.5

Script Markdown-it markdown parser

id: 3
path: C:\Users\Normal\AppData\Roaming\PBE\QOwnNotes\scripts\markdown-it\markdown-it.qml
variablesJson:

{
    "customStylesheet": "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 50px;}",
    "options": "{\n    //html:         false,        // Enable HTML tags in source\n    //xhtmlOut:     false,        // Use '/' to close single tags (<br />)\n    //breaks:       false,        // Convert '\\n' in paragraphs into <br>\n    //langPrefix:   'language-',  // CSS language prefix for fenced blocks\n    //linkify:      false,        // autoconvert URL-like texts to links\n\n    // Enable some language-neutral replacements + quotes beautification\n    //typographer:  false,\n\n    // Double + single quotes replacement pairs, when typographer enabled,\n    // and smartquotes on. Could be either a String or an Array.\n    //\n    // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n    // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n    //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n    // Highlighter function. Should return escaped HTML,\n    // or '' if the source string is not changed and should be escaped externaly.\n    // If result starts with <pre... internal wrapper is skipped.\n    //\n    // function (/*str, lang*/) { return ''; }\n    //\n    //highlight: null,\n\n    //maxNesting:   100            // Internal protection, recursion limit\n}"
}

identifier: markdown-it
version: 1.3
minAppVersion: 17.08.2

Relevant log output in the Log panel

nothing special

@pbek pbek added the question label Feb 27, 2020
@pbek
Copy link
Member

pbek commented Feb 27, 2020

See: pbek/QOwnNotes#1635 (comment)

@pbek
Copy link
Member

pbek commented Feb 27, 2020

And in case you are talking only about remote images... I don't think they ever where supported in markdown-it. I wrote a special in-memory-downloader for external images back then for the internal markdown2html process of QON.

@pbek pbek added the question label Feb 27, 2020
@cinereous
Copy link

Just a note for anyone else searching for " Qownnotes doesn't display images when using markdown-it": it can be fixed by adding file:// in front, even though it's a relative path, ie:
![Test](file://media/1.jpg) works for media/1.jpg (sub under data).

I installed a bunch of scripts when I first installed QownNotes, without knowing the consequences. (Here, spending about an hour trying to figure out why I can't see images, no matter what.)

Since everything puts out the other type of link, I'm probably just going to disable the script, unless this behavior isn't by design and it's actually a bug.

@pbek
Copy link
Member

pbek commented Jun 6, 2020

@cinereous, thank you. Is there anything you want to share as a pull request for the markdown-it script?

@cinereous
Copy link

No, I've just gone and left it disabled; hopefully if it's not something actually needed. I just installed a bunch of scripts when I installed Qownnotes, thinking they'd be needed for functionality (like, the markdown-it seemed more advanced?), but a lot of this just seems my unfamiliarity with the program.

For example, I also installed the 'insert TOC', since I really like having one, but there's an automatic (and updated) navigation on the side built-in, which makes the script seem somewhat unnecessary.

Using the web extension works brilliantly and captures images perfectly, when one doesn't unnecessarily install scripts that trash displaying the images in preview! :)

@pbek
Copy link
Member

pbek commented Jun 7, 2020

Many scripts are for and by people that want to tinker with the behavior of stuff. The image preview of the html generated by the markdown-it script only works with the "legacy image links" any more. That's why I asked if anyone wants to fix that (since the author/s of the script didn't). 😁

@pbek
Copy link
Member

pbek commented Oct 18, 2020

@milan-rusev, @bessw, does't anyone care to take a look at that? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants