asjqkkkk / markdown_widget

📖Rendering markdown by flutter!Welcome for pr and issue.
MIT License
312 stars 90 forks source link

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

Open sharan21 opened 5 months ago

sharan21 commented 5 months ago

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

asjqkkkk commented 5 months ago

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

sharan21 commented 5 months ago

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