Inheritance: IMarkdownServiceProvider
Esempio n. 1
0
 private static string DfmMarkup(string basedir, string filename, string markdownContent)
 {
     // TODO: different editor use different child process so there is no need to create dfm service each time
     DfmServiceProvider dfmServiceProvider = new DfmServiceProvider();
     IMarkdownService dfmService = dfmServiceProvider.CreateMarkdownService(new MarkdownServiceParameters {BasePath = basedir});
     return dfmService.Markup(markdownContent, filename).Html;
 }
Esempio n. 2
0
            public DfmService(
                DfmServiceProvider provider,
                string baseDir,
                string templateDir,
                ICompositionContainer container,
                ImmutableDictionary <string, string> tokens,
                IReadOnlyList <string> fallbackFolders,
                IReadOnlyDictionary <string, object> parameters)
            {
                var options = DocfxFlavoredMarked.CreateDefaultOptions();

                options.LegacyMode             = provider.LegacyMode;
                options.ShouldFixId            = provider.ShouldFixId;
                options.ShouldExportSourceInfo = true;
                _builder = new DfmEngineBuilder(
                    options,
                    baseDir,
                    templateDir,
                    fallbackFolders,
                    container);
                _builder.TokenTreeValidator = MarkdownTokenTreeValidatorFactory.Combine(provider.TokenTreeValidator);
                _tokens   = tokens;
                _renderer = CustomizedRendererCreator.CreateRenderer(new DfmRenderer {
                    Tokens = _tokens
                }, provider.DfmRendererPartProviders, parameters);
                foreach (var c in provider.DfmEngineCustomizers)
                {
                    c.Customize(_builder, parameters);
                }
                _incrementalContextHash = ComputeIncrementalContextHash(baseDir, templateDir, provider.TokenTreeValidator, parameters);
            }