using ZelWiki.Engine.Library;
using ZelWiki.Engine.Library.Interfaces;
namespace ZelWiki.Engine.Implementation
{
///
/// Handles wiki headings. These are automatically added to the table of contents.
///
public class HeadingHandler : IHeadingHandler
{
///
/// Handles wiki headings. These are automatically added to the table of contents.
///
/// Reference to the wiki state object
/// The size of the header, also used for table of table of contents indentation.
/// The self link reference.
/// The text for the self link.
public HandlerResult Handle(IZelEngineState state, int depth, string link, string text)
{
if (depth >= 2 && depth <= 6)
{
int fontSize = 8 - depth;
if (fontSize < 5) fontSize = 5;
string html = "" + text + "\r\n";
return new HandlerResult(html);
}
return new HandlerResult() { Instructions = [Constants.HandlerResultInstruction.Skip] };
}
}
}