Open CJKay opened 2 years ago
The implementation of aquamarine is using the macro quote!{ #[doc = ...} to embed into the rustdoc section the newly generated mermaid rendering script-hooks. This quote! macro is embedding as block-comment instead of using line-comments. The expanded result of Aquamarine will look similar to the following minimized example:
/// This is a comment.
///
/// This is a diagram[^1]:
/**
<script> const x = 1;</script>
*/
/// [^1]: This is a footnote.
pub fn example_with_footnote() {}
It seem this block-comment is interrupting the line-comments and causing the footnote-feature to get out of sync.
If the html-code would be added using line-comments, the footnote feature would keep working as expected
/// This is a comment.
///
/// This is a diagram[^1]:
///
/// <script> const x = 1;</script>
///
/// [^1]: This is a footnote.
pub fn example_with_footnote() {}
Either the quote! macro needs to be modified to produce line-comments or the rustdoc footnote-feature needs to be improved to cope with the switch between different comment styles.
It seems to be an issue with parsing of multi-line comments, so if the generated code would be a single line, the parser will be fine and footnotes rae respected
/// This is a comment.
///
/// This is a diagram[^1]:
/// <script src="https://unpkg.com/mermaid@9.3.0/dist/mermaid.min.js"> </script> <div>dff</div>
/// [^1]: This is a footnote.
But this does not go well with the mermaid markdown language, requiring multiline text within div-element
Comment blocks that utilise Mermaid's code blocks break footnote rendering, e.g.:
Found:
Expected (not including rendered diagram):