Disable header rows for Markdown Tables Transclusion

I have weekly Journal which I display weekly calendar. I have monthly Journal which I also display monthly calendar. I will highlight/input some event in my weekly calendar. Currently, I will need to maintain/update the same event in my monthly calendar. If I can stack up the Weekly Calendar to display Monthly Calendar, I can do away the maintenance of the Monthly Calendar.

For example, in Week 45, I have update an Event 1 on Wednesday, 01 November, in the November Week 45.md. I will need to do the same to update November Month.md.

Is there a way, to stack up, using Transclusion, the Weekly Calendar to show as Monthly Calendar?

If stack up with blank line, it will display each Weekly Calendar, with header. If I stack up without blank line in between, it has the header and the alignment code in between.

Is there a way, to stack up the Weekly Calendar (disable some header rows) so that it looks like the Monthly Calendar?

The weekly calendar markdown is as follow. Not sure why discourse display some words in colour.

> |Week |Monday |Tuesday |Wednesday |Thursday |Friday |Saturday |Sunday |
> |:--: |:--: |:--: |:--: |:--: |:--: |:--: |:--: |
> |45 | | |01 <br>**Event1**|02 |03 |04 |05 |

The only way I can think of would be a JavaScript script that turns off whatever you don’t want to see. But that’ll probably be ugly.

Well, it’s possible with CSS, at least for the case with no linefeeds between the transcluded files. One could come up with some CSS for the “with linefeeds” case, but it’s a lot more difficult: Without the headers, the table rows all have differing widths.

So, this seems to do the trick here:

<style>
table:has(> tbody:nth-of-type(2)) {
  & tbody:nth-of-type(-n+5):nth-of-type(n+2)) {
    & tr:nth-child(-n+2) {
      display: none;
    }
  }
}
</style>

That looks horrible, I know. But it seems to work in DT on Ventura, i.e. with a relatively recent WebKit. The CSS relies von the :has funciton to find those table elements having at lest two tbody children. That’s the case for the “no linefeeds” transclusion.

It then defines a rule for all tbody elements but the first one (tbody:nth-of-type(2)…tbody-nth-of-type(5)), namely to turn the display for their first two tr children off. Those are the pseudo headings and the useless :--: rows.

Here, & is the CSS nesting operator. It’s not strictyl necessary here, but I used it to break up the whole selector chain. Without &, it would look like this:

table:has(> tbody:nth-of-type(2)) tbody:nth-of-type(-n+5):nth-of-type(n+2) tr:nth-child(-n+2) {
      display: none;
}

(The image is from an earlier version of the CSS)
Making every second row in that condensed view stand out is left as an exercise for the reader :wink:

Thanks for the excellent solution. The & CSS nesting operator does not seem to work for me. I have to use the solution without the &.

Which OS are you on? It’s working here in latest Ventura.

DEVONthink 3.9.3, Ventura 13.5, MacBook Air M1.

Interesting. I’m on Ventura 13.5.1, same DT, same hardware. CSS nesting is available sind Safari 16.5, according to caniuse.com. And on Ventura 13.5.1, I have Safari 16.6.
Eventually, it’ll work as everywhere else. But it’s only syntactic sugar, anyway.

The CSS solution works perfectly on DT (left). However, when view in DTTG (right), it didn’t render correctly. Any way to fix this in DTTG?

I built a very raw MD test case as I don’t have your data any more:

<style>
p { background-color: yellow;
    color: blue;
}
table:has (> tbody:nth-of-type(2))
tbody:nth-of-type(-n+6):nth-of-type(n+2)
tr:nth-child(-n+2) {
  display: none;
} 
tbody:nth-child (even) {
   background: hsl(38, 55%, 93%);
}
</style>


One paragraph of markdown text

<table>
<thead>
<tr>
<td>Week</td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
<td>Sunday</td>
</tr>
</thead>
<tbody>
</tbody>
<thead>
<tr>
<td>Week</td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
<td>Sunday</td>
</tr>
</thead>
<tbody>
</tbody>
<thead>
<tr>
<td>Week</td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
<td>Sunday</td>
</tr>
</thead>
<tbody>
</tbody>
</table>

That works the same way on macOS as on iOS. So you probably have something somewhere in your MD files that throws the whole thing off.

What you might do to figure it out: convert the MD to HTML on macOS and show the HTML (as code, not a screenshot, please). And also show the settings for your DTTG/CSS.

Thanks for your reply. And sorry for late reply as I was away travelling.

I have resend you the sample data.

Here are the screenshot of the MD file in macOS and iPadOS.

Here is my Markdown Settings on my iPad DTTG. There is no custom CSS.

Attached is the converted HTML.

<meta charset="utf-8"/>
</head>
<body>


<h2 id="stackupweeklycalendarwithoutblankline">Stack up Weekly Calendar without blank line</h2>

<table>
<colgroup>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
<col style="text-align:center;"/>
</colgroup>

<thead>
<tr>
	<th style="text-align:center;">Week </th>
	<th style="text-align:center;">Monday </th>
	<th style="text-align:center;">Tuesday </th>
	<th style="text-align:center;">Wednesday </th>
	<th style="text-align:center;">Thursday </th>
	<th style="text-align:center;">Friday </th>
	<th style="text-align:center;">Saturday </th>
	<th style="text-align:center;">Sunday </th>
</tr>
</thead>

<tbody>
<tr>
	<td style="text-align:center;">45 </td>
	<td style="text-align:center;"> </td>
	<td style="text-align:center;"> </td>
	<td style="text-align:center;">01 <br><strong>Event1</strong></td>
	<td style="text-align:center;">02 </td>
	<td style="text-align:center;">03 </td>
	<td style="text-align:center;">04 </td>
	<td style="text-align:center;">05 </td>
</tr>
</tbody>

<tbody>
<tr>
	<td style="text-align:center;">Week </td>
	<td style="text-align:center;">Monday </td>
	<td style="text-align:center;">Tuesday </td>
	<td style="text-align:center;">Wednesday </td>
	<td style="text-align:center;">Thursday </td>
	<td style="text-align:center;">Friday </td>
	<td style="text-align:center;">Saturday </td>
	<td style="text-align:center;">Sunday </td>
</tr>
<tr>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
</tr>
<tr>
	<td style="text-align:center;">46 </td>
	<td style="text-align:center;">06 </td>
	<td style="text-align:center;">07 </td>
	<td style="text-align:center;">08 </td>
	<td style="text-align:center;">09 <br><strong>Event2</strong></td>
	<td style="text-align:center;">10 </td>
	<td style="text-align:center;">11 </td>
	<td style="text-align:center;">12 </td>
</tr>
</tbody>

<tbody>
<tr>
	<td style="text-align:center;">Week </td>
	<td style="text-align:center;">Monday </td>
	<td style="text-align:center;">Tuesday </td>
	<td style="text-align:center;">Wednesday </td>
	<td style="text-align:center;">Thursday </td>
	<td style="text-align:center;">Friday </td>
	<td style="text-align:center;">Saturday </td>
	<td style="text-align:center;">Sunday </td>
</tr>
<tr>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
</tr>
<tr>
	<td style="text-align:center;">47 </td>
	<td style="text-align:center;">13 </td>
	<td style="text-align:center;">07 </td>
	<td style="text-align:center;">08 </td>
	<td style="text-align:center;">09 </td>
	<td style="text-align:center;">10 </td>
	<td style="text-align:center;">11 </td>
	<td style="text-align:center;">12 </td>
</tr>
</tbody>

<tbody>
<tr>
	<td style="text-align:center;">Week </td>
	<td style="text-align:center;">Monday </td>
	<td style="text-align:center;">Tuesday </td>
	<td style="text-align:center;">Wednesday </td>
	<td style="text-align:center;">Thursday </td>
	<td style="text-align:center;">Friday </td>
	<td style="text-align:center;">Saturday </td>
	<td style="text-align:center;">Sunday </td>
</tr>
<tr>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
</tr>
<tr>
	<td style="text-align:center;">48 </td>
	<td style="text-align:center;">20 </td>
	<td style="text-align:center;">21 </td>
	<td style="text-align:center;">22 </td>
	<td style="text-align:center;">23 </td>
	<td style="text-align:center;">24 </td>
	<td style="text-align:center;">25 </td>
	<td style="text-align:center;">26 </td>
</tr>
</tbody>

<tbody>
<tr>
	<td style="text-align:center;">Week </td>
	<td style="text-align:center;">Monday </td>
	<td style="text-align:center;">Tuesday </td>
	<td style="text-align:center;">Wednesday </td>
	<td style="text-align:center;">Thursday </td>
	<td style="text-align:center;">Friday </td>
	<td style="text-align:center;">Saturday </td>
	<td style="text-align:center;">Sunday </td>
</tr>
<tr>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
	<td style="text-align:center;">:--: </td>
</tr>
<tr>
	<td style="text-align:center;">49 </td>
	<td style="text-align:center;">27 </td>
	<td style="text-align:center;">28 </td>
	<td style="text-align:center;">29 </td>
	<td style="text-align:center;">30 </td>
	<td style="text-align:center;"> </td>
	<td style="text-align:center;"> </td>
	<td style="text-align:center;"> </td>
</tr>
</tbody>
</table>

<style>   
table:has(> tbody:nth-of-type(2)) tbody:nth-of-type(-n+6):nth-of-type(n+2) tr:nth-child(-n+2) {   
      display: none;   
} tbody:nth-child(even) {   
      background: hsl(38, 55%, 93%);   
}   
</style>   



</body>
</html>

Here are the screenshots for the HTML file in macOS and iPadOS. Both display correctly.


You should set the same CSS on the preferences on both devices. Otherwise it can’t work.

But I didn’t set anything for CSS for both devices. I am simply using whatever default in DT or DTTG.

I’m sorry. When I read your post, I was on an iPhone and didn’t scroll down to see the style element at the bottom of the MD.

Now I took the HTML you posted, added the missing html and head elements at the top and synced it to my iPad. Where looks exactly the same as on macOS.

Which i*OS version are you on?

iOS 17.1.1, iPadOS 17.1.1.

The converted HTML is displayed correctly in both DT and DTTG. It is just the MD that is not displayed correctly in DTTG (iOS or iPadOS).

Send you a PM as this does not belong in the forum anymore.

As has been noted many times, DEVONthink To Go ≠ DEVONthink nor is macOS ≠ iOS / iPadOS. The underlying technologies are not the same in many cases and this also includes the text engine in our apps. Also, our text engine in DEVONthink To Go is still new and evolving. Please bear those things in mind.

DEVONthink To Go inserted transcluded text with newlines. The next version will no longer do this but just replace the placeholder with the transcluded text.

1 Like

Testing…

… and looking good :slight_smile: