Rename markdownToPlainText -> stripMarkdownFormatting

It better reflects what the function actually does
This commit is contained in:
Vishesh Handa
2019-05-13 22:57:49 +02:00
parent 4f939c662e
commit ad2e4ac9b1
3 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ class MarkdownBuilder implements md.NodeVisitor {
}
}
String markdownToPlainText(String markdown) {
String stripMarkdownFormatting(String markdown) {
final List<String> lines = markdown.replaceAll('\r\n', '\n').split('\n');
var doc = md.Document(encodeHtml: false);

View File

@ -77,7 +77,7 @@ class JournalList extends StatelessWidget {
title = basename(journal.filePath);
}
var body = markdownToPlainText(journal.body);
var body = stripMarkdownFormatting(journal.body);
var textTheme = Theme.of(context).textTheme;
var children = <Widget>[];

View File

@ -2,10 +2,10 @@ import 'package:journal/utils/markdown.dart';
import 'package:test/test.dart';
void main() {
group('Markdown To Text', () {
group('Markdown Remove Formatting', () {
test('Test Headers', () {
var input = '# Hello\nHow are you?';
expect(markdownToPlainText(input), 'Hello How are you?');
expect(stripMarkdownFormatting(input), 'Hello How are you?');
});
test('Test Header2', () {
@ -15,7 +15,7 @@ void main() {
Hello
""";
expect(markdownToPlainText(input), 'Test Header Hello');
expect(stripMarkdownFormatting(input), 'Test Header Hello');
});
test('Itemized LIsts', () {
@ -26,7 +26,7 @@ look like:
* that one
""";
expect(markdownToPlainText(input),
expect(stripMarkdownFormatting(input),
'Itemized lists look like: this one that one');
});
});