-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
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
Pandoc markdown and notes #637
Comments
Working on it. Adding some pointers if anyone else is interested. All the render is made in the Here is an idea proposed by @AnaGelez :
|
Since cpull-markdown is used in Plume to translate md to html, I looked at https://github.com/raphlinus/pulldown-cmark/blob/master/tests/suite/footnotes.rs and things looks good on this side. There is no closed issue about a bug like this, in the upstream package, any ideas ? |
Ok, here is an update of what i've found so far :
Code : #[test]
fn test_markdown_notes() {
let md = r##"Awesome[^1]
[^1]: here is the note definition !
"##;
let (s, _, _) = md_to_html(md, None, false, None);
println!("{}", s)
} Output : <p>Awesome<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>here is the note definition</p>
</div> Here is the result I get on the final page generated by Plume : With [^n]: <article class="e-content" dir="auto">
<p>Awesome<sup><a href="#postcontent-1" rel="noopener noreferrer">1</a></sup></p>
<p><br></p>
<div id="postcontent-1"><sup>1</sup>
<p>here is the note definition !</p>
</div>
</article> With [^n] <article class="e-content" dir="auto">
<p>Awesome<sup><a href="#postcontent-1" rel="noopener noreferrer">1</a></sup></p>
<p><br></p>
<p><sup><a href="#postcontent-1" rel="noopener noreferrer">1</a></sup> here is the note definition !</p>
</article> Now, i'm having hard times finding where the page get translated from |
Still digging on this, here is a test of #[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_html_note_to_safe_string() {
let html = r##"<p>Awesome<sup class="footnote-reference"><a href="#1">1</a></sup>
<sup class="footnote-reference"><a href="#1">1</a></sup>: here is the note definition !</p>"##;
let s = SafeString::new(html);
println!("{}", s);
}
} Output : <p>Awesome<sup><a href="#postcontent-1" rel="noopener noreferrer">1</a></sup>
<sup><a href="#postcontent-1" rel="noopener noreferrer">1</a></sup>: here is the note definition !</p> |
The markdown syntax used in Plume is quite satisfactory, but there should be at least one small correction: adapt the syntax of the notes to the pandoc flavor.
Usually, when writing markdown, most editors use the following syntax to create note calls and references:
However, with Plume, you have to use:
The absence of the colon prevents you from writing in markdown in a classic editor, then importing the text into Plume without adjusting the notes. The opposite is also true.
The text was updated successfully, but these errors were encountered: