Finished Headers. Need help for more pseudo-headers

I’m writing a codex book in markdown, the one explained here: Code of Canon Law
and a standard html page from which I extract the text is i.e. C.I.C. from Vatican web site- Book 1, Title 8

I used:

  • H1 for the general book title:
    .# Code of Canon Law
  • H2s are used for ‘SubBooks’ (they are called ‘book’ too but only all seven formed an indivisible ‘unicum’):
    .## Book I. General Norms (Cann. 1–203)

    .## Book VII. Processes (Cann. 1400–1752)
  • H3s are used for ‘Parts’ (in which every ‘SubBooks’ should be divided):
    .### Part I
    .### Part II
  • H4s are used for ‘Sections’ (in which every ‘Part’ should be divided):
    .#### Section I
    .#### Section II
  • H5s are used for ‘Titles’ (two or more for every ‘Section’):
    .##### Title I
    .##### Title II
  • H6s are used to indicate if there are one or more ‘Articles’ that compose a ‘Title’:
    .##### Article I
    .##### Article II

Now I’m looking for a way to write others three subheaders in which every articles is divided:

  • ‘Canons’ (that are 1752)
  • ‘Paragraph’ (not in all ‘Canons’ but in the most of its)
  • ‘Numbers’ (same as ‘Paragraph’)

Here an example of the above last 3:

Can. 135 - §1. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

§2. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

§3. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

§4. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

( <br> are used by me only to structurate text as in the original way)
A Js script running in Firefox Consolle extract all text from the Web page and when finished I got:

Can. 135
§1. Lorem ipsum...
§2. Lorem ipsum...
§3. Lorem ipsum...
§4. Lorem ipsum...

What I’m trying to do

How to link all Canons, Paragraph and Numbers if I’ll find in other part of text or in other file?

So I try to give a ‘anchor’ to all as shown:
\n
Can. 135 ^ccar-cic-c135\n
\n
§1. Lorem ipsum ^ccar-cic-c135-c1\n
\n
§2. Lorem ipsum ^ccar-cic-c135-c2\n
\n
§3. Lorem ipsum ^ccar-cic-c135-c3\n
\n
§4. Lorem ipsum ^ccar-cic-c135-c4\n
\n
\n

As You can see,

  • ‘ccar-cic’ is the file name: ccar-cic.md
  • ‘-c135’ is the 'Canon number
  • ‘-c1’ is the paragraph number (in Italian is called ‘Comma’, that’s because the ‘c’)
  • \n are indicated to show You where are the real end lines.
    All this is wrote for me by the Js script, not all done by hand!

Now… If I link this anchor in other file, ‘Paragraphs’ are render well, i.e. :

As ‘Blockquote’
Test link Can. 135, ![[/ccar-cic#^ccar-cic-c135-c1]]
Test link Can. 135, ![[/ccar-cic#^ccar-cic-c135-c2]]
Test link Can. 135, ![[/ccar-cic#^ccar-cic-c135-c3]]
Test link Can. 135, ![[/ccar-cic#^ccar-cic-c135-c4]]

As ‘Internal link’, same: with CTRL + Mouse hover Paragraphs are evidenced well
Test link [[/ccar-cic#^ccar-cic-c135-c1|Can. 135, §1]]
Test link [[/ccar-cic#^ccar-cic-c135-c2|Can. 135, §2]]
Test link [[/ccar-cic#^ccar-cic-c135-c3|Can. 135, §3]]
Test link [[/ccar-cic#^ccar-cic-c135-c4Can. 135, §4]]

But… If I try to anchor ‘Canon’… nothing to do. 'Cause this:
Can. 135 ^ccar-cic-c135 only show me ‘Can. 135’ and not all 4s Paragraphs.
If I move ‘^ccar-cic-c135’ at the end of the block, before Can. 136 same…
Any help or idea to achieve the above’ll be very usefoul.
thanks in advance
Emanuele Tinari

One option is to give a heading to the most granular item you want to reference—the Canon— then step the heading levels up from there. When you run out of headings, bubble up to a containing note.

By my count, that happens at the Section level if you want to allow for Comma in some Canons. But you could “bubble up” sooner if you want.

This would let you link to headings at every level, no block IDs required.

You could imagine it as letting the note serve as a container for the info that does fit versus trying to make the info fit.

For example…

In a note named Code of Canon Law.md, link to or embed the section notes:

## Book I

General Norms

### Part I

#### Section I

![[Code of Canon Law - Book I - Part I - Section I]]

#### Section II

![[Code of Canon Law - Book I - Part I - Section II]]

(etc.)

Then in a section note named Code of Canon Law - Book I - Part I - Section I.md, you could do:

---
Part: "[[Code of Cannon Law#Book I#Part 1]]"
Section: I

---

# Section I

## Title I

Lorem ipsum

### Article I

Lorem ipsum

#### Can. 1

##### Comma 1

###### §1

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  

###### §2

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  

#### Can. 2

(etc.)

I would not mark the book title as a heading. That gives you 1 more level to work with, which takes care of the Canons. Then you can use block links for paragraphs and numbers. (If I wanted to make the title look unlike body text, I would use HTML & CSS.)

I also support Dawni’s multi-file idea. It is common in ePub files (which are essentially a website in a zip file) for each chapter to be its own file, with the chapter title marked as an h1.