I am trying to make Block Properties play nice with external editors/viewers but I only found an usable solution in actually hiding the Logseq Properties.
I wanted to showcase the mess that block properties make when rendered with external editors (VSCodium):
Let’s start with just the “collapsed:: true”:
But, when many more Properties are added, some being whole sentences, some LaTEX formulas (maybe), some containing Links… it becomes a real mess and, while reading the markdown in an external editor, one will understand almost nothing:
Markdown specifies that two spaces at the end of a line define a soft-break so, when I add two spaces at the end of each property line, they show ok, one per line, in the rendering of the external app but as soon as I collapse the block in Logseq and “collapsed:: true” is added to the properties list, Logseq strips those trailing spaces and all the properties will still show again on a single line.
At least two trailing spaces at the end of the Block’s Title Paragraph will remain consistent and, to achieve the next Paragraph in the Block to start below the properties, a new Soft-Break can be added after the properties, so at least I have now delimited the properties from the rest of the content. But I am not happy with a Blob of stuff with no proper formatting hanging in there. Markdown should be readable and pretty.
The solution I have found is enclosing the whole properties section in a “split hidden markdown link”:
- Some block Title or Paragraph (# ' property1:: value1 property2:: value2 ') Second Paragraph in the Block...
This will keep the properties visible in Logseq but they will be hidden when the markdown will be rendered in an external editor. I have no solution for properties to show pretty in external app markdown renderings yet:
In Logseq the “split hidden markdown link” will be visible, which is a hindrance and maybe can be hidden with some clever CSS and at least the source markdown file doesn’t loose this metadata which can contain valuable data that I don’t want stripped off when exporting for example.
The only solution I see atm is to duplicate the need-to-be-visible block properties and edit them in a table so that at least they do show up in the Markdown file:
This is not ideal and, from my pov, Logseq should be able to make properties available in the Markdown file in a “render-able” format that doesn’t require this level of hacking so the Markdown files become actually Markdown files.
Edit: hiding the properties in the Markdown file can also be achieved with a HTML comment:
- Some block Title or Paragraph <!-- property1:: value1 property2:: value2 --> Second Paragraph in the Block...
and, even if the properties will work as expected in Logseq, the two issues remain: 1) there is no visual of the properties in the rendering of the Markdown (as they are hidden) and 2) in Logseq, the
--> will be visible outside of edit mode;