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

Code wrapper used in PreConfig only works for code blocks and not inline code #169

Open
sharan21 opened this issue Apr 7, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@sharan21
Copy link

sharan21 commented Apr 7, 2024

I am using the same CodeWrapper defined in the demo doc along with PreConfig to configure light and dark colors to be used.

Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: MarkdownGenerator().buildWidgets(
                        config: MarkdownConfig.defaultConfig.copy(
                          configs: [
                            const PreConfig().copy(
                              wrapper: codeWrapper,
                              textStyle: const TextStyle(fontFamily: 'RobotoMono'),
                              decoration: BoxDecoration(
                                color: isDark ? const Color.fromARGB(255, 29, 29, 29) : Colors.white,
                                borderRadius: const BorderRadius.all(Radius.circular(8.0)),
                              ),
                            ),
                          ],
                        ),
                        message.message,
                      ),
                    ),

This is only being applied to block code that is surrounded by triple back ticks like

this

But this wrapper is not being applied for inline code that is surround by single backticks i.e. like this

Below is an example of how the dark colors are getting applied for the code block but not the inline code.
Screenshot 2024-04-08 at 1 19 49 AM

How do I make the wrapper also apply for inline code? TIA

@sharan21 sharan21 added the bug Something isn't working label Apr 7, 2024
@asjqkkkk
Copy link
Owner

asjqkkkk commented Apr 9, 2024

Hi @sharan21 , you need use CodeConfig to customize the inline code

@sharan21
Copy link
Author

sharan21 commented Apr 9, 2024

Hey @asjqkkkk thanks for the reply. Can you please give an example on how this can be done?

@itzhoujun
Copy link

@asjqkkkk CodeConfig only support textStyle. How to customize code's padding and border radio

@asjqkkkk
Copy link
Owner

@sharan21 like this:

MarkdownWidget(
                  data: data,
                  config: config.copy(configs: [
                    isDark
                        ? PreConfig.darkConfig.copy(...)
                        : PreConfig().copy(...)
                  ]),
                )

@asjqkkkk
Copy link
Owner

Hi @itzhoujun , now the textstyle is not supporting for border radius and padding, because the CodeConfig is using TextStyle-backgroundColor to show the color block

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

No branches or pull requests

3 participants