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

Desktop: Export of mermaid render no longer works on 2.6.4+ #5879

Closed
graphit0 opened this issue Dec 19, 2021 · 5 comments
Closed

Desktop: Export of mermaid render no longer works on 2.6.4+ #5879

graphit0 opened this issue Dec 19, 2021 · 5 comments
Labels
bug It's a bug desktop All desktop platforms high High priority issues

Comments

@graphit0
Copy link

graphit0 commented Dec 19, 2021

PDF and HTML File export of mermaid renders stopped working on 2.6.9 and shows up as plain code

image_2021-12-18_23-45-34

Environment

Joplin version: 2.6.9
First appears at 2.6.4: 2.6.2 is unaffected
wonder if commit 98ed2be might have something to do with it
Platform: prod, win32; prod, linux is untested
OS specifics: Tested on Windows 7, reported on Mac OS 12.0.1 as well

Steps to reproduce

  1. Create a note
  2. paste mermaid graph
flowchart TD
a --- b
Loading
  1. Export the note as PDF or HTML File
  2. Open the note and see unrendered mermaid code

Describe what you expected to happen

The rendered graph to be present in exported document

Notes

  • PlantUML, katex, tables, checkboxes, etc are unaffected
  • Mermaid graphs render fine in the Joplin view mode
  • HTML Directory export seems to be unaffected

Logfile

Export HTML result:  
{warnings: Array(0)}
warnings: []
[[Prototype]]: Object
constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
valueOf: ƒ valueOf()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
__proto__: (...)
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
@graphit0 graphit0 added the bug It's a bug label Dec 19, 2021
@tessus
Copy link
Collaborator

tessus commented Dec 19, 2021

To also put my findings here:

I have reverted both Mermaid commits (06e427f and c499473) for testing and it still does not work, so it has nothing to do with these 2 commits.

Unfortunately I don't know what the culprit is, but at least I could eliminate my 2 commits related to Mermaid.

@Daeraxa
Copy link
Collaborator

Daeraxa commented Dec 19, 2021

Results of me playing around:

It is broken in the same commit as the other issue, the html pack commit 98ed2be

Did some more playing and got rid of just the last function and got the graph back, so it is something in there or something that it calls upon. (commented out the whole last public async close() function and change it to just async close() {})

Played a bit more and changed this line

this.packIntoSingleFile_ = 'packIntoSingleFile' in options ? options.packIntoSingleFile : true;
to false and it works again - because it then bypasses the extra code in that function I mentioned before.
this.packIntoSingleFile_ = 'packIntoSingleFile' in options ? options.packIntoSingleFile : false;

Is there a reason why exporting to PDF needs to go via the additional code added for the HTML single file packing? The change notes imply this should only fire for exporting as a single HTML.

@tessus
Copy link
Collaborator

tessus commented Dec 19, 2021

Is there a reason why exporting to PDF needs to go via the additional code added for the HTML single file packing?

Not that I can think of, but I didn't make that change. I remember a few issues we had a while back with toc not working when certain unicode characters were used in headings. But it had nothing to do with single file packing.

@laurent22 laurent22 added desktop All desktop platforms high High priority issues labels Dec 19, 2021
@laurent22
Copy link
Owner

Hmm, yes if it can't be fixed in htmlpack we can probably just bypass it for PDF export. It's indeed not necessary in this case.

@yiyinyiyang
Copy link

In the 2.5.12 version of the test, working fine, but in the latest 2.6.9 version, when exporting PDF and html mermaid render effect will not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues
Projects
None yet
Development

No branches or pull requests

5 participants