Possible Enhancements to Markdown Export?

Hi there!

Before opening an issue in the github repository, I first wanted to share my issue here just so, someone could add to it and even correct me If I am missing something.

I am a casual user of SiYuan and love to use it for writing my markdown generated blogs. However, when exporting my content to Markdown, I do seem to note some missing options everytime. I believe these features should be essential in the essence of SiYuan documents to be truly converted and exported to markdown.

This one is a major missing feature and should actually be present there. Whenever we export a SiYuan document with embedded blocks, the content of these embeded blocks can be exported as simple text in the markdown document, which actually is a good option for it. However, this cannot be the case with reference blocks, these references are not and should acutally be coverted to raw markdown links. Thus, this loses the relationships and links between the exported markdown documents.

A simple solution for it should be to include reference documents along the exported document with proper markdown links just as in the case of assets.

This one is a minor ehancement since it doesn't disrupt the workflow like the first one.

Whenever we export a SiYuan document with PDF annotation links, the annotated document is exported as an asset with the markdown link for the doucment. However, this markdown link seems to have a query parameter, just like the one SiYuan uses internally.

For Example, the exported annotation would look like:

[Annotation Text](assets/Annotated_PDF-date-id.pdf?p=31)

Ofcourse it won't work outside SiYuan. But I found out that if we replace the query parameter with an anchor instead, this actually works!

So if the above example could be converted to this:

[Annotation Text](assets/Annotated_PDF-date-id.pdf#p=31)

Not only will the PDF annotation refer to the correct PDF document but also to one of its correct pages form where the annotation was taken from. Which really means that upon clicking this markdown link, the PDF with the designated page with open for us.


I believe these two are the only features stopping the markdown export from truly being phenomenal. If I missed something or any feature, please provide feedback to me, since that is the purpose of sharing this insight here.

^^, Cheers 🥂.

    Welcome to here!

    Here we can learn from each other how to use SiYuan, give feedback and suggestions, and build SiYuan together.

    Signup About
    Please input reply content ...
    • avcton
      Author

      Hi there...

      The past two issues opened by you have indeed been solved but now there seems to be a bug in the new export that I needed to report to you.

      Let's say if I have a SiYuan document with referenced text from a pdf in one of my assets. This markdown file when exported from this document now no longer has the referenced pdf as an asset.

      Please find the attached screenshot demonstrating the issue:
      CleanShot20240806at5.07.372x.png

    • MiscReply
    • 88250 1

      I understand what you mean now. Please pay attention to the following two issues:

      Thank you.

      1 Reply
    • 88250
      1. image.png
      2. Please help test whether this format is feasible [Annotation Text](assets/Annotated_PDF-date-id.pdf#page=31)
      1 Reply
    • avcton 1
      Author

      Hey there. Thanks for the response.

      1. I already did tried the 'Anchor hash' option before but it only seems to work with markdown links, when you're exporting an entire notebook. Which means if you're exporting a single document the markdown links to other documents are lost and SiYuan links are used instead in the markdown file. Also, lets consider that it can't be helped since we are selectively exporting a single document at the time. But even if you just export a single document into markdown, SiYuan also exports all of its subdocuments. Which if it does, then in order to introduce consistency, it should also convert their in between references or reference blocks to markdown links. Currently it directly exports the SiYuan links, which only seems to work in SiYuan. I hope the attached demonstratoin clarifies what I am trying to highlight here. Demonstration.png
      2. There was a typo from my end and I would like to correct the format I mentioned before. It actually is [Annotation Text](assets/Annotated_PDF-date-id.pdf#page={number}). This format is standardly applicable in many pdf viewers such as Adobe Acrobat and even web based implementations of Google Chrome, Firefox and Microsoft Edge. However, it really isn't a standard and is only just widely supported, therefore it’s not guaranteed to work in all environments. But it also doesn't break anything and in cases where it doesn't work, this hyperlink format still has the same behaviour as the current one implemented in SiYuan. So It's a plus to use it since it is widely supported in major pdf viewers. I have attached a demonstration for web based pdf viewers with this format for a link generated through SiYuan. CleanShot20240624at9.12.04.gif
      1 Reply