You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何AsciiDoc表格中502/504状态码显示异常?求解决方案

HTTP状态码表格渲染异常的原因与解决方法

问题原因

  1. 属性引用未定义
    AsciiDoc中用{}包裹的内容属于属性引用,只有提前定义过对应的属性,渲染时才会替换为目标内容。你的文档中应该已经定义了:503: **503**这类属性,所以{503}能正常渲染为粗体的503;但未定义:502: **502**和:504: **504**,导致{502}、{504}被原样输出,锚点的正常渲染也受此影响。

  2. 锚点ID笔误
    504状态码对应的锚点写为[[status-code-54]],属于ID错误,正确的锚点ID应该是[[status-code-504]],错误的ID会导致锚点标签无法正常生成。

解决方法

方案一:直接使用粗体语法替换属性引用

不需要依赖属性定义,直接将状态码用**包裹实现粗体,同时修正锚点ID,修改后的表格代码如下:

[cols="10%,70%,20%",options="header",]
|=======================================================================
|Code |Meaning |Methods
|[[status-code-502]]**502**|
Gateway error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
|{ALL}

|[[status-code-503]]**503**|
Service Unavailable - service is (temporarily) not available (e.g. if a
required component or downstream service is not available) -- client retry may
be sensible. If possible, the service should indicate how long the client
should wait by setting the {Retry-After} header.
|{ALL}

|[[status-code-504]]**504**|
Gateway error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
|{ALL}
|=======================================================================

方案二:补充属性定义并修正锚点ID

在文档的开头(表格之前)添加状态码对应的属性定义,同时修正504的锚点ID:

:502: **502**
:503: **503**
:504: **504**

[cols="10%,70%,20%",options="header",]
|=======================================================================
|Code |Meaning |Methods
|[[status-code-502]]{502}|
Gateway error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
|{ALL}

|[[status-code-503]]{503}|
Service Unavailable - service is (temporarily) not available (e.g. if a
required component or downstream service is not available) -- client retry may
be sensible. If possible, the service should indicate how long the client
should wait by setting the {Retry-After} header.
|{ALL}

|[[status-code-504]]{504}|
Gateway error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
|{ALL}
|=======================================================================

内容的提问来源于stack exchange,提问作者Prasad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 07:27:23