Deprecate 4 public methods; will be made private (#307)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 353daf7..dc00725 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 2.1.8
+
+* Deprecate the _public_ methods `ListSyntax.removeLeadingEmptyLine`,
+ `ListSyntax.removeTrailingEmptyLines`, `TableSyntax.parseAlignments`,
+ `TableSyntax.parseRow`. These will be made private in a major version bump as
+ early as 3.0.0.
+
## 2.1.7
* Add dependency on the meta package
diff --git a/lib/src/block_parser.dart b/lib/src/block_parser.dart
index 311c2be..74d7839 100644
--- a/lib/src/block_parser.dart
+++ b/lib/src/block_parser.dart
@@ -755,8 +755,8 @@
endItem();
var itemNodes = <Element>[];
- items.forEach(removeLeadingEmptyLine);
- var anyEmptyLines = removeTrailingEmptyLines(items);
+ items.forEach(_removeLeadingEmptyLine);
+ var anyEmptyLines = _removeTrailingEmptyLines(items);
var anyEmptyLinesBetweenBlocks = false;
for (var item in items) {
@@ -795,15 +795,20 @@
}
}
- void removeLeadingEmptyLine(ListItem item) {
+ void _removeLeadingEmptyLine(ListItem item) {
if (item.lines.isNotEmpty && _emptyPattern.hasMatch(item.lines.first)) {
item.lines.removeAt(0);
}
}
+ @Deprecated(
+ 'Public method was intended to be private; will be removed in a major '
+ 'version release, as early as markdown 3.0.0')
+ void removeLeadingEmptyLine(ListItem item) => _removeLeadingEmptyLine(item);
+
/// Removes any trailing empty lines and notes whether any items are separated
/// by such lines.
- bool removeTrailingEmptyLines(List<ListItem> items) {
+ bool _removeTrailingEmptyLines(List<ListItem> items) {
var anyEmpty = false;
for (var i = 0; i < items.length; i++) {
if (items[i].lines.length == 1) continue;
@@ -818,6 +823,12 @@
return anyEmpty;
}
+ @Deprecated(
+ 'Public method was intended to be private; will be removed in a major '
+ 'version release, as early as markdown 3.0.0')
+ bool removeTrailingEmptyLines(List<ListItem> items) =>
+ _removeTrailingEmptyLines(items);
+
static int _expandedTabLength(String input) {
var length = 0;
for (var char in input.codeUnits) {
@@ -873,9 +884,9 @@
/// * many body rows of body cells (`<td>` cells)
@override
Node parse(BlockParser parser) {
- var alignments = parseAlignments(parser.next);
+ var alignments = _parseAlignments(parser.next);
var columnCount = alignments.length;
- var headRow = parseRow(parser, alignments, 'th');
+ var headRow = _parseRow(parser, alignments, 'th');
if (headRow.children.length != columnCount) {
return null;
}
@@ -886,7 +897,7 @@
var rows = <Element>[];
while (!parser.isDone && !BlockSyntax.isAtBlockEnd(parser)) {
- var row = parseRow(parser, alignments, 'td');
+ var row = _parseRow(parser, alignments, 'td');
var children = row.children;
if (children != null) {
while (children.length < columnCount) {
@@ -911,7 +922,7 @@
}
}
- List<String> parseAlignments(String line) {
+ List<String> _parseAlignments(String line) {
var startIndex = _walkPastOpeningPipe(line);
var endIndex = line.length - 1;
@@ -937,12 +948,17 @@
}).toList();
}
+ @Deprecated(
+ 'Public method was intended to be private; will be removed in a major '
+ 'version release, as early as markdown 3.0.0')
+ List<String> parseAlignments(String line) => _parseAlignments(line);
+
/// Parses a table row at the current line into a table row element, with
/// parsed table cells.
///
/// [alignments] is used to annotate an alignment on each cell, and
/// [cellType] is used to declare either "td" or "th" cells.
- Element parseRow(
+ Element _parseRow(
BlockParser parser, List<String> alignments, String cellType) {
var line = parser.current;
var cells = <String>[];
@@ -1010,6 +1026,13 @@
return Element('tr', row);
}
+ @Deprecated(
+ 'Public method was intended to be private; will be removed in a major '
+ 'version release, as early as markdown 3.0.0')
+ Element parseRow(
+ BlockParser parser, List<String> alignments, String cellType) =>
+ _parseRow(parser, alignments, cellType);
+
/// Walks past whitespace in [line] starting at [index].
///
/// Returns the index of the first non-whitespace character.
diff --git a/lib/src/version.dart b/lib/src/version.dart
index f39844c..7369037 100644
--- a/lib/src/version.dart
+++ b/lib/src/version.dart
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
-const packageVersion = '2.1.7';
+const packageVersion = '2.1.8';
diff --git a/pubspec.yaml b/pubspec.yaml
index 9151883..a23d01a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: markdown
-version: 2.1.7
+version: 2.1.8
description: A library for converting markdown to HTML.
homepage: https://github.com/dart-lang/markdown