refactor: update markdown dependencies and enhance rendering capabilities

- Added flutter_markdown_plus as a new dependency for improved markdown rendering.
- Removed deprecated markdown_widget and related LaTeX handling, streamlining the codebase.
- Updated the ConduitMarkdown class to utilize the new markdown processing logic, enhancing maintainability.
- Improved the StreamingMarkdownWidget to leverage the updated markdown rendering methods, ensuring a cohesive user experience.
- Enhanced support for LaTeX and Mermaid diagrams within markdown content, providing better visual representation.
This commit is contained in:
cogwheel0
2025-10-04 23:05:03 +05:30
parent 758ed411b0
commit a4319a1d9e
6 changed files with 396 additions and 491 deletions

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:markdown_widget/markdown_widget.dart';
import '../../theme/theme_extensions.dart';
import 'markdown_config.dart';
import 'markdown_preprocessor.dart';
@@ -27,17 +25,13 @@ class StreamingMarkdownWidget extends StatelessWidget {
final normalized = ConduitMarkdownPreprocessor.normalize(content);
final mermaidRegex = RegExp(r'```mermaid\s*([\s\S]*?)```', multiLine: true);
final matches = mermaidRegex.allMatches(normalized).toList();
final renderComponents = ConduitMarkdown.prepare(
context,
onTapLink: onTapLink,
);
Widget buildMarkdown(String data) {
return MarkdownBlock(
return ConduitMarkdown.buildBlock(
context: context,
data: data,
onTapLink: onTapLink,
selectable: false,
config: renderComponents.config,
generator: renderComponents.generator,
);
}