-
Notifications
You must be signed in to change notification settings - Fork 68
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
support spoiler tags #304
Comments
I really hope this gets implemented!!! |
For this, we would need to add in some custom logic to the Markdown parser to be able to detect spoiler tags as I think this is not something native to Markdown Another point with this is that we should then support adding spoiler tags when creating or editing posts/comments |
I did some experimenting with this. Markdown does "support" collapsible content, like this:
But this is really working using html. This example works when testing with this: https://dart-lang.github.io/markdown/ But for obvious reasons, doesn't when using a flutter markdown library. And Lemmy has it's own syntax for spoiler with the triple colon. |
I believe at some point we may need to fork https://github.com/flutter/packages/tree/main/packages/flutter_markdown |
We might not need to fork the markdown package. I think you can extend the package to add in custom syntax logic: https://pub.dev/documentation/markdown/latest/markdown/ExtensionSet-class.html |
I started taking a look at this, and I think we may need to fork For some background, I was able to add a custom https://gist.github.com/micahmo/9ed15cb884b79850a787816e1f9af497 Using just the Input void main() {
print(
markdownToHtml(
"""### This is a title
This is a body
::: spoiler This is my spoiler title
This is my spoiler body
:::
And more...""",
blockSyntaxes: [
SpoilerBlockSyntax(),
],
),
);
} Output <h3>This is a title</h3>
<p>This is a body</p>
<details><summary>This is my spoiler title</summary><a>This is my spoiler body</a></details>
<p>And more...</p> Rendered
So far so good! However, once we pass that through https://github.com/flutter/packages/blob/main/packages/flutter_markdown/lib/src/style_sheet.dart As a result, I get a null issue on this line, where it assumes that the given https://github.com/flutter/packages/blob/main/packages/flutter_markdown/lib/src/builder.dart#L632 If anyone else would like to give it a try and let me know if I'm missing something, I'd appreciate it! |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
support spoiler tags in comments in the form of
::: spoiler label
Hidden text
:::
Describe the solution you'd like
A clear and concise description of what you want to happen.
Text hidden until you click on it
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context

Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: