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
Markdown inside <summary> and <details> not being processed #155
Comments
The HTML elements "details" and "summary" are part of HTML5 which kramdown only supports partially. I have looked at the spec and a fully correct implementation is not possible for "summary" since it supports two different content models. This will be fixed in the next version so that both elements are recognized as having a block content model. |
@cheloizaguirre Please keep in mind that you will still have (i.e. after fixing this in kramdown) to use the parse_block_html option or that you need to a "markdown" attribute to the |
…k content model (fixes #155) Note that the <summary> element was using the span content model prior to this change but the block content model is better suited (both are allowed by the HTML5 spec).
@eneko Just so that you know pictures are quite worthless when it comes to determining problems. Better show the input, the false output and the expected output as text. As for your question: As written in #155 (comment) you need to enable the 'parse_block_html' option. |
Thanks! Yeah, I thought of pasting some code examples, but too much escaping to show the issue. Took the lazy path :) Thanks, if I understand it properly, the
I assume there is no other way to get this working on GitHub pages that do not have a config file, correct? |
For Jekyll related questions please ask on some Jekyll forum or something similar since I don't use Jekyll as my static website generator. |
@gettalong sorry to bother you again. Do you have any examples of this feature working with Kramdown, whether is with Jekyll or not? I am failing to get it to work, not sure what I'm missing. |
@eneko You can always use the kramdown binary to check whether the problem lies with kramdown or the tool that uses kramdown, like this:
As you can see the kramdown markup is correctly processed within the |
Ok, I think I found the problem, thanks for the command line example. The HTML Looks like if a
The nested Nested
|
@gettalong, let me know if you would like me to open a new issue, if that makes things easier. |
As stated in the syntax documentation, the closing tag for an HTML tag must start on a new line if the contents is parsed as block elements:
|
Ok, thanks. That is pretty close to the desired output. Is there any way to prevent the |
Maybe |
How elements get rendered depends on the CSS; therefore kramdown can do nothing in this regard. If you don't want to parse the contents of an HTML tag as block elements, you should use the 'parse_block_html' option. Alternatively, you can specify
|
Oh man, that works like a charm! 👍. Thank you very much! Here is some working examples: |
This was inspired by [this excellent talk][talk] by Daniele Procida wherein he said that tutorials (which I *think* this is) should have no extra material, no explanations. I’m not quite ready to delete these asides; I feel they are useful content and might be worth keeping somewhere! But for now at least I can collapse them so that people won’t be distracted by them unless they want to be. I found the `markdown="span"` trick in [this issue][issue]. [talk]: https://www.youtube.com/watch?v=azf6yzuJt54 [issue]: gettalong/kramdown#155 (comment)
This was inspired by [this excellent talk][talk] by Daniele Procida wherein he said that tutorials (which I *think* this is) should have no extra material, no explanations. I’m not quite ready to delete these asides; I feel they are useful content and might be worth keeping somewhere! But for now at least I can collapse them so that people won’t be distracted by them unless they want to be. I found the `markdown="span"` trick in [this issue][issue]. [talk]: https://www.youtube.com/watch?v=azf6yzuJt54 [issue]: gettalong/kramdown#155 (comment)
This was inspired by [this excellent talk][talk] by Daniele Procida wherein he said that tutorials (which I *think* this is) should have no extra material, no explanations. I’m not quite ready to delete these asides; I feel they are useful content and might be worth keeping somewhere! But for now at least I can collapse them so that people won’t be distracted by them unless they want to be. I found the `markdown="span"` trick in [this issue][issue]. [talk]: https://www.youtube.com/watch?v=azf6yzuJt54 [issue]: gettalong/kramdown#155 (comment)
This was inspired by [this excellent talk][talk] by Daniele Procida wherein he said that tutorials (which I *think* this is) should have no extra material, no explanations. I’m not quite ready to delete these asides; I feel they are useful content and might be worth keeping somewhere! But for now at least I can collapse them so that people won’t be distracted by them unless they want to be. I found the `markdown="span"` trick in [this issue][issue]. [talk]: https://www.youtube.com/watch?v=azf6yzuJt54 [issue]: gettalong/kramdown#155 (comment)
Refs #139 [docs] Add framework definition to getting started guide Along with link to the home page (readme, in the repo) [docs] Add link to getting started guide to home page WIP++ Start adding basics part/page WIP++ add “basics” diagram WIP++ WIP++ WIP++ Getting Started Guide » Basics WIP++ move all new docs into the docs dir WIP++ I begrudgingly agreed to go with data-stores instead of datastores You win this time, Charles! WIP++ tweaks, fixes, minor updates WIP++ TODO! Synchronize definitions of FC4 AND call it a Docs as Data Framework I *think* that’s correct but I need to confirm and I need to find a link. [docs] Address errors reported by bin/lint-markdown WIP++ Fix how asides are rendered Their contents weren’t being rendered properly because apparently Kramdown, the default Markdown processor of our SSB software Jekyll (which is required if I want GitHub pages to build the site) doesn’t process Markdown inside of HTML tags by default. So I had to add the config file to override that default. WIP++ Collapse asides by default This was inspired by [this excellent talk][talk] by Daniele Procida wherein he said that tutorials (which I *think* this is) should have no extra material, no explanations. I’m not quite ready to delete these asides; I feel they are useful content and might be worth keeping somewhere! But for now at least I can collapse them so that people won’t be distracted by them unless they want to be. I found the `markdown="span"` trick in [this issue][issue]. [talk]: https://www.youtube.com/watch?v=azf6yzuJt54 [issue]: gettalong/kramdown#155 (comment) [skip CI] WIP++ fix some typos [skip CI] Use `datastore` and `datatype` consistently I discussed with Charles and basically I wore him down and he doesn’t care anymore 😬 WIP++
adding |
for someone else trying to find a solution for github comments. I found that adding a non-breaking space character (nbsp) aka extended-ascii code 255
becomes Summary Goes HereHeader
|
Ref : root-project/web#529 (comment) (Thanks 👏 ) If we do something like:
it will be rendered something like : Our summary hereour markdown text here : echo "Hello markdown"
html tags also supported
Edit - 1 - Its to rendering properly on github page |
@souravdas142 your solution worked perfectly for me as part of GitHub /github pages with markdown |
* Update README.md * UPDATE: remove nest.js study repository * UPDATE: add K-SW Square Program in Experience * UPDATE: add <details> html tags * UPDATE: link to Weltried project * UPDATE: the breaking html tags with gettalong/kramdown#155 * UPDATE: add the contribution repository `pynecone` * UPDATE: format of Experience * DELETE: github readme badge
to whom it might concern, I've solved the issue by adding <details>
<summary><strong>A strong summary</strong></summary>
<div markdown=1>
This is fine:
* first
* second
</div>
</details> |
I'm trying to use the
and
The output of that ends up being:
I've tried using the parse_block_html option and adding markdown="1" or markdown="span" to the HTML tags, but the text inside there just gets ignored.
I looked in https://github.com/gettalong/kramdown/blob/master/lib/kramdown/parser/html.rb#L57 and it seems like
should be working as expected, though
I'm totally willing to look into it myself if you can point me in the direction of a good place to start. Thanks!
The text was updated successfully, but these errors were encountered: