We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
markdown 图片自定义渲染,token.attrGet('alt') 获取不到值。 md.renderer.rules.image = (tokens, idx, options, env, self) => { const token = tokens[idx]; let alt = token.attrGet('alt'); console.log("alt :"+ alt); let result = self.renderToken(tokens, idx, options); if (alt) { result +=\n } return result; } 这段代码alt的值获取不到。
md.renderer.rules.image = (tokens, idx, options, env, self) => { const token = tokens[idx]; let alt = token.attrGet('alt'); console.log("alt :"+ alt); let result = self.renderToken(tokens, idx, options); if (alt) { result +=
} return result; }
config.js 的markdown配置中配置如下: md.renderer.rules.image = (tokens, idx, options, env, self) => { const token = tokens[idx]; let alt = token.attrGet('alt'); console.log("alt :"+ alt); let result = self.renderToken(tokens, idx, options); if (alt) { result +=\n } return result; }
希望可以取到alt属性值。
System: OS: macOS 15.3.1 CPU: (8) arm64 Apple M1 Memory: 77.58 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 23.6.0 - ~/.nvm/versions/node/v23.6.0/bin/node npm: 10.9.2 - ~/.nvm/versions/node/v23.6.0/bin/npm pnpm: 8.15.0 - ~/Library/pnpm/pnpm Browsers: Chrome: 133.0.6943.142 Safari: 18.3 npmPackages: vitepress: ^1.6.3 => 1.6.3
No response
The text was updated successfully, but these errors were encountered:
use token.content
token.content
Sorry, something went wrong.
but ,the case is <img src="/page_214_1.png" alt="图 14-1" style="zoom:25%;" /> won't work in this case .
<img src="/page_214_1.png" alt="图 14-1" style="zoom:25%;" />
could you please share the project of the picture,so i can debug myself。
No branches or pull requests
Describe the bug
markdown 图片自定义渲染,token.attrGet('alt') 获取不到值。
md.renderer.rules.image = (tokens, idx, options, env, self) => { const token = tokens[idx]; let alt = token.attrGet('alt'); console.log("alt :"+ alt); let result = self.renderToken(tokens, idx, options); if (alt) { result +=
\n} return result; }
这段代码alt的值获取不到。
Reproduction
config.js 的markdown配置中配置如下:
md.renderer.rules.image = (tokens, idx, options, env, self) => { const token = tokens[idx]; let alt = token.attrGet('alt'); console.log("alt :"+ alt); let result = self.renderToken(tokens, idx, options); if (alt) { result +=
\n} return result; }
Expected behavior
希望可以取到alt属性值。
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: