Open Tomblarom opened 10 months ago
Same issue for code snippets, like in Code Server... @vedderb haven't you noticed that yet in your own packages?
Can you try with the latest beta? The markdown-support in Qt is not that good and in the latest beta I'm trying to manually parse it and generate html from it instead. It should work better for code blocks, but I'm not sure if https-images work for all platforms. Http should work.
Saw your commit, great that there is such a library as maddy!
For code-blocks, yes they are working now :) For https-images on Windows, yes it does also load from https! Is there a chance to include images in the package, as local resource, rather than external? Might be a little bit overkill, but images help a lot to explain stuff visually.
I can have a look at that.
Regarding maddy, I rewrote six of the parsers, but that is not visible in the commit unfortunately. The image parser has image caching support now: https://github.com/vedderb/vesc_tool/blob/master/maddy/imageparser.h
I also spent a lot of work on the codeblock parser and I rewrote four others as they were super slow https://github.com/progsource/maddy/issues/50#issuecomment-1808263340
For QMarkdownEdit I fixed one bug that made it crash during some of the edit operations and I added support for changing the colors of everything depending on the vesc tool theme.
Resizing is not working yet. It tried to use HTML <img src=".." alt=".." width="300"/>
.
This is what you can get working in the Qt editors: https://doc.qt.io/qt-6/richtext-html-subset.html#block-attributes You can see that img does not support the resize attribute. I can maybe fix that too by updating the image-parser to resize the image before caching it, but best is to scale the image to the correct size from the start.
I tested the list now, it works for me. Do you have a way to reproduce the problem?
Do you have a way to reproduce the problem?
The issue was on my side, therefor I deleted it. The line before 1.
contained a space.
btw, loading existing packages into VESC Tool under "Create Package" is broken currently. :(
Loading on "Load Custom" works fine :)
That happens because I broke compatibility a bit with old packages by storing the raw data as markdown instead of html. I will add some code to detect if it is an old package and load the text as html instead.
Regarding images, I think I can embed them in the packages so that they are stored locally. It is a bit tricky to make that work so that github also renders the images correctly, but I think it can be done with some clever caching.
This fix should allow opening old packages properly: https://github.com/vedderb/vesc_tool/commit/1275db4797792d5962239b89562ec100eaebf4bf
I have also added a markdown preview that is updated live next to the markdown editor:
The beta is updated now.
I tried your new editor with a .vescpkg
that has been created with the previous version of VESC-Tool "Create Package". I send you the file.
I experience that the live-updates are very slow (1-2s), because it has an embedded image which is not beeing rendered, but shown as: ![image](data:image/13196.PNG;base64,i VBORw0KGgoAAAANSU.....hEUgAAAfQSUVORK5CYII=)
. Page "Load Custom" renders it correctly.
I'm running Windows 10 21H2 and do compile using Qt Creator 11.0.3, Qt 5.15.2, MinGW 8.1.0 64-bit and CMake 3.24.2. I also tried to make a release with windeployqt build-vesc_tool-Desktop_Qt_5_15_2_MinGW_64_bit-Release\release
, but same outcome.
And the order of generated Markdown-symbols are a little bit mixed in page "Create Package": **_Locate Connector**_
instead of **_Locate Connector_**
Code block generation is like this:
Conversion to markdown will not be perfect from old packages, it is mostly a help to transition from them to markdown. Base64 for the images (which was used before) will also not work that well with markdown. The load package page will work better in comparison as it does not try to convert it to markdown.
According to the used function
QTextDocument::setMarkdown(..)
in vesc_tool/main.cpp, the completeMarkdownDialectGitHub
is supported, including images.However when compiling the description file, this formatting results in "not found images":
When generating the description and saving the package with VESC-Tool, it includes the images perfectly fine.