Skip to content
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

Doesn't work as expected when text is from a dynamic source and not hardcoded string #1

Open
edocabhi opened this issue Jun 18, 2020 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@edocabhi
Copy link

No description provided.

@Autokaka
Copy link
Owner

Sorry, I don't know what you mean. Do you mean that after changing the content of the "text" param in RefinedMarkdown widget, the widget won't change its state and reload as expected?
I tried to load the string from an asset file asynchronously, and it seems that it worked as expected. Here is my code:

class _MarkdownPageState extends State<MarkdownPage> {
  String text = "Loading asset string...";

  Future<void> loadDemo() async {
    String demoStr = await rootBundle.loadString('assets/demo.md');
    setState(() => text = demoStr);
  }

  @override
  void initState() {
    super.initState();
    loadDemo();
  }

  @override
  Widget build(BuildContext context) {
    CSS baseCSS = CSS();
    baseCSS.fontSize = 13;
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: Text('Markdown Test'),
      ),
      body: RefinedMarkdown(
        text: text,
        css: baseCSS,
      ),
    );
  }
}

And after setting state, the widget just shows the same result as the screenshot in demo:
image
Actually I cannot figure out exactly what problem you are facing. Please give me a more detailed description about this issue, test code would be best, thank you.
By the way, this widget don't support all markdown standards for now. I'll add those supports after this month since I'm going to take lots of exams this month and I have no time for this. If this problem occurs because of markdown standard, it would be fixed in the later version of refined_markdown. :)

@Autokaka Autokaka added bug Something isn't working question Further information is requested labels Jun 18, 2020
@edocabhi
Copy link
Author

edocabhi commented Jun 19, 2020

I am trying to maintain multilingual markdown content in https://app.lokalise.com/ and later use it to render the content in the app.

Take the following example


Heading

Content

Heading2

Content2


For the above in markdown, I would write

## Heading

#### Content

## Heading2

#### Content2

This is a very simple content and when I hardcode the string to a variable and render it works. However, when I pull the markdown content from the lokalise platform weird \n characters start to appear in the render and the content is broken. I am using HTML render instead for now but would love to switch to this markdown plugin again.

Great job so far :) Good luck with your exams !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants