예제 #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}");
        }
예제 #2
0
 public static CodeFenceOptionsParseResult Succeeded(CodeBlockAnnotations annotations) => new SuccessfulCodeFenceOptionParseResult(annotations);