Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Markdown/Md.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DefaultNamespace;

public class Md
{
TextHTML Render(TextMarkDown markDown) //принимает MarkDown текст состоящий из токенов
{ //и переводит конкретные токены к конкретному виду. HTML

}
}
8 changes: 8 additions & 0 deletions Markdown/TextHTML.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace DefaultNamespace;

public class TextHTML
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А для чего нужен отдельный тип, который оборачивает строку? Какую логику он будет в себе инкапсулировать?

{
string html_data_;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В C# принят camelCase, давай здесь и дальше по коду этого придерживаться?

TextHTML()//заглушка
{}
}
24 changes: 24 additions & 0 deletions Markdown/TextMarkDown.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace DefaultNamespace;

public class TextMarkDown
{
private Token[] tokens_;
private string data_;

TextMarkDown(string text) // Берёт текст и заполняет массив token
{}
string Data
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут не хватает модификатора + ниже тоже

{
get
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно писать просто get;, если не требуется какая-то особая логика при получении значения

{
return data_;
}
}
Token[] Tokens
{
get
{
return tokens_;
}
}
}
18 changes: 18 additions & 0 deletions Markdown/Token.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace DefaultNamespace;

public class Token
{
private TokenType type_; //тип токена
private Tuple<int, int> index_; //содержание токена, индекс начала и конца
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скорее всего это не индекс, а какой-то отрезок или интервал. Давай подберем более говорящее название? + Кортеж значений вида (int Begin, int End) ... будет выглядеть чуть прозрачнее, посмотри в эту сторону. Будет круто, если опишешь преимущества такого типа над обычным Tupl'ом

TokenType TokenType
{
get { return type; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже достаточно { get; set; }. Расписывать базовую реализацию не нужно

set { type = value; }
}

Tuple<int, int> Index
{
get { return index_; }
set { index_ = value; }
}
}
9 changes: 9 additions & 0 deletions Markdown/TokenType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DefaultNamespace;

public enum TokenType
{
Italic,
Bold,
Escaped,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подсвети, пожалуйста, что это за тип токена? + Понадобится ли тип Text?

Heading
}