Mkdocs 术语表搜索返回一大段

问题描述 投票:0回答:1

mkdocslossary.md 文件中的每个术语表条目在编辑器中的编写方式如下,条目之间有一个行空格:

Transaction Fee { #transaction_fee }
: Amount of cryptocurrency that must be paid by anybody submitting a transaction for inclusion on a blockchain. These fees reward block producers for their work processing transactions, and typically vary depending on network congestion.

Trustless { #trustless }
: A quality of a decentralized blockchain. Requires no parties to know or trust one another because there is no intermediary, i.e., no individual or central entity has authority or control over the system. Instead, transactions are processed according to agreed upon governance through [smart contracts](#smart_contract). At Flare, the process is secured at the network level, meaning that it is inherited by all subprotocols.

每个词汇表条目的链接(例如:

glossary.md#blockchain
)或对
blockchain
的搜索都会将整个词汇表作为一个大段落返回:the entire glossary as one paragraph

mkdocs 似乎无法识别每个条目的新段落。我们如何为每个词汇表条目编写降价,并能够从其他页面或搜索栏定位每个搜索条目?

我们对降价进行了如下编码:

Transaction Fee { #transaction_fee }
: Amount of cryptocurrency that must be paid by anybody submitting a transaction for inclusion on a blockchain. These fees reward block producers for their work processing transactions, and typically vary depending on network congestion.

Trustless { #trustless }
: A quality of a decentralized blockchain. Requires no parties to know or trust one another because there is no intermediary, i.e., no individual or central entity has authority or control over the system. Instead, transactions are processed according to agreed upon governance through [smart contracts](#smart_contract). At Flare, the process is secured at the network level, meaning that it is inherited by all subprotocols.

预期搜索和链接 (glossary.md#entry_term) 返回特定条目,而不是整个页面。

search markdown mkdocs glossary
1个回答
0
投票

您需要使用标题将搜索索引分解为更小的块。

McDocs 的搜索索引将以两种方式索引页面:

  1. 整个页面被转换为单个纯文本块(您所看到的)。
  2. 页面被分成较小的纯文本块。页面中的每个标题对应一个块。

例如,考虑以下示例页面:

This text is not under a heading and will only be included in the whole page block of the search index.

# Heading 1

This text will be included both in the whole page block and in a block under "Heading 1"

## Heading 1.1

This text will be included both in the whole page block and in a block under "Heading 1.1" (It is not included under "Heading 1")

This text will also be included both in the whole page block and in a block under "Heading 1.1"

# Heading 2

This text will be included both in the whole page block and in a block under "Heading 2"

要使搜索索引按照您的意愿运行,您需要使用标题而不是定义列表。

# Transaction Fee { #transaction_fee }

Amount of cryptocurrency that must be paid by anybody submitting a transaction for inclusion on a blockchain. These fees reward block producers for their work processing transactions, and typically vary depending on network congestion.

# Trustless { #trustless }

A quality of a decentralized blockchain. Requires no parties to know or trust one another because there is no intermediary, i.e., no individual or central entity has authority or control over the system. Instead, transactions are processed according to agreed upon governance through [smart contracts](#smart_contract). At Flare, the process is secured at the network level, meaning that it is inherited by all subprotocols.

请注意,您仍然可以使用定义列表,但呈现的 HTML 并不完全符合您的预期。但它仍然有效。

## Transaction Fee { #transaction_fee }
: Amount of cryptocurrency that must be paid by anybody submitting a transaction for inclusion on a blockchain. These fees reward block producers for their work processing transactions, and typically vary depending on network congestion.

## Trustless { #trustless }
: A quality of a decentralized blockchain. Requires no parties to know or trust one another because there is no intermediary, i.e., no individual or central entity has authority or control over the system. Instead, transactions are processed according to agreed upon governance through [smart contracts](#smart_contract). At Flare, the process is secured at the network level, meaning that it is inherited by all subprotocols.
© www.soinside.com 2019 - 2024. All rights reserved.