private static void Main()
        {
            new System.Windows.Application(); //needed for correct resource loading

            var rendererCache = new HtmlRendererCache();

            if (Directory.Exists(rendererCache.CacheDirectory))
            {
                Directory.Delete(rendererCache.CacheDirectory, true);
            }

            if (Directory.Exists(OutputPath))
            {
                Directory.Delete(OutputPath, true);
            }
            Directory.CreateDirectory(OutputPath);

            var form = new Form();

            form.Load +=
                (s, e) =>
            {
                renderer = new HtmlRenderer();
#pragma warning disable VSTHRD110
                Task.Run(new Action(GenerateSnippets));
#pragma warning restore VSTHRD110
            };
            Application.Run(form); //we need message pump for web browser
        }
Beispiel #2
0
    internal static RentedCustomHtmlRenderer RentCustomHtmlRenderer(this MarkdownPipeline pipeline)
    {
        HtmlRendererCache  cache    = _rendererCache ??= new(pipeline);
        CustomHtmlRenderer renderer = cache.Get();

        return(new(cache, renderer));
    }
Beispiel #3
0
 internal HtmlRenderer GetCacheableHtmlRenderer()
 {
     if (_rendererCache is null)
     {
         _rendererCache = new HtmlRendererCache
         {
             OnNewInstanceCreated = Setup
         };
     }
     return(_rendererCache.Get());
 }
Beispiel #4
0
        internal RentedHtmlRenderer RentHtmlRenderer(TextWriter?writer = null)
        {
            HtmlRendererCache cache = writer is null
                ? _rendererCache ??= new HtmlRendererCache(this, customWriter: false)
                : _rendererCacheForCustomWriter ??= new HtmlRendererCache(this, customWriter: true);

            HtmlRenderer renderer = cache.Get();

            if (writer is not null)
            {
                renderer.Writer = writer;
            }

            return(new RentedHtmlRenderer(cache, renderer));
        }
Beispiel #5
0
 internal RentedHtmlRenderer(HtmlRendererCache cache, HtmlRenderer renderer)
 {
     _cache   = cache;
     Instance = renderer;
 }