Does it support document composition? #532

Closed
opened 2026-01-29 14:38:55 +00:00 by claunia · 1 comment
Owner

Originally created by @UnnecessaryPunctuation on GitHub (Apr 29, 2022).

Does MarkDig supports document composition?
Where some Link to md document get included in the rendered document?

Given 2 documents like :

Document_1.md

# Table of contents
* [Introduction](#user-content-introduction)
* [Another section](#user-content-another-section)
* [Credits](#user-content-credits)

# Introduction
[foo](Import:link/introduction.md)

# Another section
Some more text would go here.

# Credits
And the credits would go here.

Here indroduction have a link for composition [foo](Import:link/introduction.md).

Introduction.md

=From loren ipsum markdown=
Palato et admonuit atque vires, tu quibus praebuit bracchia. Vivere mea inque
quam motis pro verba verum, quod lucis sibi.

1. Resolvit insignis verba fuisset et solent Hesperidas
2. Et tum frondere proximus
3. Frigore tuta quoque melior trepidans ducitur cervicibus
4. Umentes consiliique dies sanguine summisque turba
5. Medio carinis
6. Quid nec quae tua fores vulneris

The rendered Md will be : introduction md got inserted in the base document.

# Table of contents
* [Introduction](#user-content-introduction)
* [Another section](#user-content-another-section)
* [Credits](#user-content-credits)

# Introduction
=From loren ipsum markdown=
Palato et admonuit atque vires, tu quibus praebuit bracchia. Vivere mea inque
quam motis pro verba verum, quod lucis sibi.

1. Resolvit insignis verba fuisset et solent Hesperidas
2. Et tum frondere proximus
3. Frigore tuta quoque melior trepidans ducitur cervicibus
4. Umentes consiliique dies sanguine summisque turba
5. Medio carinis
6. Quid nec quae tua fores vulneris

# Another section
Some more text would go here.

# Credits
And the credits would go here.
Originally created by @UnnecessaryPunctuation on GitHub (Apr 29, 2022). Does MarkDig supports document composition? Where some Link to md document get included in the rendered document? Given 2 documents like : Document_1.md ```md # Table of contents * [Introduction](#user-content-introduction) * [Another section](#user-content-another-section) * [Credits](#user-content-credits) # Introduction [foo](Import:link/introduction.md) # Another section Some more text would go here. # Credits And the credits would go here. ``` Here indroduction have a link for composition `[foo](Import:link/introduction.md)`. Introduction.md ```md =From loren ipsum markdown= Palato et admonuit atque vires, tu quibus praebuit bracchia. Vivere mea inque quam motis pro verba verum, quod lucis sibi. 1. Resolvit insignis verba fuisset et solent Hesperidas 2. Et tum frondere proximus 3. Frigore tuta quoque melior trepidans ducitur cervicibus 4. Umentes consiliique dies sanguine summisque turba 5. Medio carinis 6. Quid nec quae tua fores vulneris ``` The rendered Md will be : introduction md got inserted in the base document. ``` # Table of contents * [Introduction](#user-content-introduction) * [Another section](#user-content-another-section) * [Credits](#user-content-credits) # Introduction =From loren ipsum markdown= Palato et admonuit atque vires, tu quibus praebuit bracchia. Vivere mea inque quam motis pro verba verum, quod lucis sibi. 1. Resolvit insignis verba fuisset et solent Hesperidas 2. Et tum frondere proximus 3. Frigore tuta quoque melior trepidans ducitur cervicibus 4. Umentes consiliique dies sanguine summisque turba 5. Medio carinis 6. Quid nec quae tua fores vulneris # Another section Some more text would go here. # Credits And the credits would go here. ```
claunia added the question label 2026-01-29 14:38:55 +00:00
Author
Owner

@xoofx commented on GitHub (Apr 29, 2022):

Does MarkDig supports document composition?

No (Similar question: #618 )
But you can do it by parsing to a SyntaxTree, inspect the links (e.g via doc.Descendants<LinkInline>()), do the Markdown.Parsing on the reference link, copy the content of the parse into the other syntax tree and render from it.

@xoofx commented on GitHub (Apr 29, 2022): > Does MarkDig supports document composition? No (Similar question: #618 ) But you can do it by parsing to a SyntaxTree, inspect the links (e.g via `doc.Descendants<LinkInline>()`), do the Markdown.Parsing on the reference link, copy the content of the parse into the other syntax tree and render from it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#532