Esempio n. 1
0
        protected virtual async Task AddAttributes(CodeBlockAnnotations annotations)
        {
            await annotations.AddAttributes(this);

            AddAttribute("data-trydotnet-order", Order.ToString("F0"));

            AddAttribute("data-trydotnet-mode", annotations.Editable ? "editor" : "include");

            if (annotations.DestinationFile != null)
            {
                AddAttributeIfNotExist(
                    "data-trydotnet-file-name",
                    Path.GetFileName(annotations.DestinationFile.Value));
            }

            if (annotations.Hidden)
            {
                AddAttribute("data-trydotnet-visibility", "hidden");
            }

            AddAttributeIfNotNull("data-trydotnet-region", annotations.Region);
            AddAttributeIfNotNull("data-trydotnet-session-id", annotations.Session);
            AddAttribute("class", $"language-{annotations.NormalizedLanguage}");
        }
Esempio n. 2
0
 public static CodeFenceOptionsParseResult Succeeded(CodeBlockAnnotations annotations) => new SuccessfulCodeFenceOptionParseResult(annotations);