Organizing markdowns of a collection into subfolders and generating single html from multiple markdowns

I want to put md files in a collection _notes, but group them in folders. A big html of a topic will be generated from multiple md files.

Here is my attempt

_notes
 ├-database.md
 └-compiler.md
_note_sections
 ├-database
 | ├-indexing.md
 | └-concurrency.md
 └-compiler
   ├-assembly.md
   └-parsing.md
-layouts
 ├-note.html
 └-note_section.html

Each md file in _notes_sections stores the actual content and has layout note_section e.g.

---
section_title: xxx
layout: note_section
---

Testing text
{% highlight python %}
dfs_r(Node n, MBR w)...
{% endhighlight %}

Each md file in _notes combines multiple note_sections by showing them from expandible arrows and has layout note, here is the layout file note.html:

---
layout: default
---
{% include mathjax.html %}
{% assign subfolder = 'compiler/' %}
<ul class="note_sections">
  {% for note_section in site.note_sections %} {% if note_section.relative_path contains subfolder %}
  <li>
    <details>
      <summary>{{note_section.section_title}}</summary>
      {{note_section.content}}
    </details>
  </li>
  {% endif %} {% endfor %}
</ul>

while note_section.html is simply

---
layout: default
---
{{content}}

However, when generating the html into _site/notes, the compiler.html simply has the raw markdown content

.
.
.
<li>
  <details>
    Testing text
    {% highlight python %}
    dfs_r(Node n, MBR w)...
    {% endhighlight %}
    </details>
</li>
.
.
.

instead of turning the note_section markdowns into html which would turn the code snippet in markdown into these long html tags

<figure class="highlight"><pre><code class="language-python" data-lang="python"><span class="nf">

However, I do get a _site/note_sections/compiler/assembly.html file with the correct html generated from the note_section markdown. It is what I want to put inside the big topic html under notes, not just put the raw markdown inside.

There is no way to do what you want, it’s not supported in Jekyll. You are supposed to just generate one html from one md.

I think there is a markdownify filter? try {{note_section.content | markdownify }}

I did try adding markdownify, the result is the same as without

I’d try doing it in simpler ways to try and isolate it - like remove all the html (li, details/summary) from the for each section and see if that works, maybe it doesn’t like rendering it inside html.

You might also be able to pass it to an include - so try it with the include having that whole li details section and then pass it the content.

Also maybe try it with 3 back tics surrounding the code block instead of the highlight tag.

Since you are getting the content to work the only issue is the code block - so I think there is hope to get it to work, just not sure what the trick is.

Are the code samples always python? maybe try putting the highlight tag in the note.html layout file instead of the collection files?

I’ve not used the highlighting stuff much so not that experienced with it.