rust-lang / rust-lang/mdBook

Add predefined reference files for compilation

Open
#2,422 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

Problem

Hello, I have some scenarios here. Currently, mdbook has certain functions that are great.
For example: {{#include file}}, but I want to use this function to reference some definition links of other files to facilitate the management of some special definition content without having to define a link in a single file each time.
Here is a scenario I use

The following is my src directory structure

.
├── SUMMARY.md
├── chapter_1.md
├── customize
│   └── something.md
└── definds.md

2 directories, 4 files

Now let's focus on the definds.md file first, which defines some links

[something]:./customize/something.md

The something link points to the contents of a customize/something.md file

In the chapter_1.md file, I used the unique include command provided by the mdbook program to include definds.md, and used the content defined in definds.md to act on something

{{#include definds.md}}
# Chapter 1

related to [something][something]

ok, in this case, it will be convenient for me to manage this kind of external definition file in a unified way without adding it to the SUMMARY.md index.

Let's try to run mdbook serve, when I open the website, and navigate to chapter_1, when I bring you something, something bad happens, the link is broken, it tells me that the content link cannot be found

In the book/customize under the compilation directory, I found that the external link defined in definds.md was not recognized and compiled it. Moreover, I found that the link in chapter_1.md was also incorrect.

Proposed Solution

Same feature request
#1802,#2408,#702 ,#830

We hope to support this kind of external link link detection and compile it into an html file in parallel, so that it does not have to be defined in the SUMMARY.md file.

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the related requests #1802, #2408, #702, and #830, then reproduce the example with definds.md, chapter_1.md, and customize/something.md using mdbook serve. Trace how included definitions and links are compiled outside SUMMARY.md; done means the generated chapter resolves the external link correctly without adding the definition file to SUMMARY.md.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, rust
Domain
build-system, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.