You could convert your sub HTMLs into Base64 strings and link them using the Data URI scheme in your main HTML:
- Create your sub HTML file:
<!-- sub.html -->
<html>
<head>
<title>
Sub HTML
</title>
</head>
<body>
<h1>Sub HTML</h1>
<p>This is the Sub HTML.</p>
</body>
</html>
- Convert its file content to Base64 (e.g. using base64encode.org):
PCEtLSBzdWIuaHRtbCAtLT4NCjxodG1sPg0KIDxoZWFkPg0KICA8dGl0bGU+DQogICBTdWIgSFRNTA0KICA8L3RpdGxlPg0KIDwvaGVhZD4NCjxib2R5Pg0KIDxoMT5TdWIgSFRNTDwvaDE+DQogPHA+VGhpcyBpcyB0aGUgU3ViIEhUTUwuPC9wPg0KPC9ib2R5Pg0KPC9odG1sPg==
- Create your main HTML linking the sub HTML by a Data URI with the Base64 encoding of the target file:
<!-- main.html -->
<html>
<head>
<title>
Main HTML
</title>
</head>
<body>
<h1>Main HTML</h1>
<p> This is the Main HTML. </p>
<p>
<a href="sub.html">
This link to the sub HTML
</a>
references the target by its (relative) path and won't work without the
2nd file.
<br>
<a href="data:text/html
;UFT8
;base64,PCEtLSBzdWIuaHRtbCAtLT4NCjxodG1sPg0KIDxoZWFkPg0KICA8dGl0b
GU+DQogICBTdWIgSFRNTA0KICA8L3RpdGxlPg0KIDwvaGVhZD4NCjxib2
R5Pg0KIDxoMT5TdWIgSFRNTDwvaDE+DQogPHA+VGhpcyBpcyB0aGUgU3V
iIEhUTUwuPC9wPg0KPC9ib2R5Pg0KPC9odG1sPg==
">
This link to the sub HTML
</a>
references the target by its Base64 encoding and will work without the
2nd file.
</p>
</body>
</html>
edit:
Since the question was specifically asked about pandoc
, here is the above example using Markdown:
- Create your sub Markdown file:
# Sub HTML
This is the sub HTML.
- Convert your sub Markdown file to HTML using
pandoc
:
pandoc sub.md > sub.html
- Convert your sub HTML file to Base64:
base64 < sub.html
PGgxIGlkPSJzdWItaHRtbCI+U3ViIEhUTUw8L2gxPgo8cD5UaGlzIGlzIHRoZSBzdWIgSFRNTC48
L3A+Cg==
- Create your main Markdown file referencing the sub HTML file by a Data URI:
# Main HTML
This is the main HTML.
[This link to the sub HTML][relative_path] references the target by its
(relative) path and won't work without the 2nd file.
[This link to the sub HTML][data_uri] references the target by its Base64
encoding and will work without the 2nd file.
[relative_path]: sub.html
[data_uri]: data:text/html;ASCII-US;base64,PGgxIGlkPSJzdWItaHRtbCI+U3ViIEhU
TUw8L2gxPgo8cD5UaGlzIGlzIHRoZSBzdWIgSFRNTC48L3A+Cg==
- Convert your main Markdown file to HTML using
pandoc
:
pandoc main.md > main.html