コード例 #1
0
ファイル: ImageTest.cs プロジェクト: dlech/docfx
        public void ComplexImageTestBlockGeneral()
        {
            var source = @"
:::image type=""icon"" source=""example.svg"":::

:::image type=""complex"" source=""example.jpg"" alt-text=""example"" loc-scope=""azure""::: 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
:::image-end:::

:::image source=""example.jpg"" alt-text=""example"" loc-scope=""azure"":::
";

            var expected = @"<img src=""example.svg"" role=""presentation"">
<img src=""example.jpg"" alt=""example"" aria-describedby=""42570"">
<div id=""42570"" class=""visually-hidden"">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<img src=""example.jpg"" alt=""example"">
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #2
0
ファイル: CodeSnippetTest.cs プロジェクト: xuan2261/docfx
        public void TestDfmFencesInlineLevel_Legacy()
        {
            var root = @"
[!code-FakeREST[REST](api.json)][!Code-FakeREST-i[REST-i](api.json ""This is root"")][!CODE[No Language](api.json)][!code-js[empty](api.json)]
";

            var apiJsonContent = @"
{
   ""method"": ""GET"",
   ""resourceFormat"": ""https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End"",
   ""requestUrl"": ""https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End"",
   ""requestHeaders"": {
                ""Accept"": ""application/json""
   }
}";
            var expected       = "<p><pre><code class=\"lang-FakeREST\" name=\"REST\">\n{\n   &quot;method&quot;: &quot;GET&quot;,\n   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestHeaders&quot;: {\n                &quot;Accept&quot;: &quot;application/json&quot;\n   }\n}\n</code></pre><pre><code class=\"lang-FakeREST-i\" name=\"REST-i\" title=\"This is root\">\n{\n   &quot;method&quot;: &quot;GET&quot;,\n   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestHeaders&quot;: {\n                &quot;Accept&quot;: &quot;application/json&quot;\n   }\n}\n</code></pre><pre><code name=\"No Language\">\n{\n   &quot;method&quot;: &quot;GET&quot;,\n   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestHeaders&quot;: {\n                &quot;Accept&quot;: &quot;application/json&quot;\n   }\n}\n</code></pre><pre><code class=\"lang-js\" name=\"empty\">\n{\n   &quot;method&quot;: &quot;GET&quot;,\n   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,\n   &quot;requestHeaders&quot;: {\n                &quot;Accept&quot;: &quot;application/json&quot;\n   }\n}\n</code></pre></p>\n";

            TestUtility.VerifyMarkup(root, expected, files: new Dictionary <string, string>
            {
                { "api.json", apiJsonContent },
            });
        }
コード例 #3
0
ファイル: CodeSnippetTest.cs プロジェクト: xuan2261/docfx
        public void CodeSnippetShouldVerifyTagname()
        {
            //arrange
            var content = @"    line for start & end
    // <tag1>
    line1
    // <Content=""my"">
    // </tag1>
" + " \tline for indent & range";

            var markdown = @"[!code-csharp[name](Program.cs#tag1)]";

            // assert
            var expected = @"<pre><code class=""lang-csharp"" name=""name"">line1
// &lt;Content=&quot;my&quot;&gt;
</code></pre>";

            TestUtility.VerifyMarkup(markdown, expected, files: new Dictionary <string, string>
            {
                { "Program.cs", content },
            });
        }
コード例 #4
0
        public void ContentImageTestBlock_LinkAttribute()
        {
            var source = @"
:::image source=""example.svg"" alt-text=""Lorum Ipsom"" link=""https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1919278"":::

:::image source=""example.svg"" lightbox=""example.svg"" alt-text=""Lorum Ipsom"" link=""https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1919278"":::
";

            var expected = @"<p class=""mx-imgBorder"">
<a href=""https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1919278"">
<img src=""example.svg"" alt=""Lorum Ipsom"">
</a>
</p>
<p class=""mx-imgBorder"">
<a href=""https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1919278"">
<img src=""example.svg"" alt=""Lorum Ipsom"">
</a>
</p>
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #5
0
        public void QuoteSectionNoteTest_CornerCases()
        {
            var source   = @"> [!Video https://test]
> [!Video]
> [!NOTE] no text here
> [!TIP
> [!di-no-v class=""whatever""]
> [!WARNING]";
            var expected = @"<div class=""embeddedvideo""><iframe src=""https://test/"" frameborder=""0"" allowfullscreen=""true""></iframe></div>
<blockquote>
<p>[!Video]
[!NOTE] no text here
[!TIP
[!di-no-v class=&quot;whatever&quot;]</p>
</blockquote>
<div class=""WARNING"">
<h5>WARNING</h5>
</div>
";

            TestUtility.VerifyMarkup(source, expected, new[] { "invalid-note-section" });
        }
コード例 #6
0
ファイル: CodeSnippetTest.cs プロジェクト: xuan2261/docfx
        public void TestDfmFencesBlockLevelWithQueryString(string fencesPath, string expectedContent)
        {
            // arrange
            var content = @"namespace ConsoleApplication1
{
    // <namespace>
    using System;
    using System.Collections.Generic;
    using System.IO;
    // </namespace>

    // <snippetprogram>
    class Program
    {
        static void Main(string[] args)
        {
            string s = ""\ntest"";
            int i = 100;
        }
    }
    // </snippetprogram>

    #region Helper
    internal static class Helper
    {
        #region Foo
        public static void Foo()
        {
        }
        #endregion Foo
    }
    #endregion
}";

            TestUtility.VerifyMarkup(fencesPath, expectedContent, files: new Dictionary <string, string>
            {
                { "Program.cs", content },
            });
        }
コード例 #7
0
        public void ImageWithIconTypeTestBlockGeneral()
        {
            var source = @":::image type=""icon"" source=""example.svg"":::

:::image type=""icon"" source=""example.svg"" border=""true"":::

:::image type=""icon"" source=""example.svg"" border=""true""::: And this with inline text.";

            var expected = @"<p><img src=""example.svg"" role=""presentation"">
</p>
<p><span class=""mx-imgBorder"">
<img src=""example.svg"" role=""presentation"">
</span>
</p>
<p><span class=""mx-imgBorder"">
<img src=""example.svg"" role=""presentation"">
</span>
 And this with inline text.</p>
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #8
0
        public void LineNumberTest_General()
        {
            // prepare
            string content = @"
# a simple test for line number
- list member 1
- list member 2
***
[Two Line Link](
http://spec.commonmark.org/0.27/)";

            // assert
            var expected = @"<h1 id=""a-simple-test-for-line-number"" sourceFile=""Topic.md"" sourceStartLineNumber=""2"">a simple test for line number</h1>
<ul sourceFile=""Topic.md"" sourceStartLineNumber=""3"">
<li sourceFile=""Topic.md"" sourceStartLineNumber=""3"">list member 1</li>
<li sourceFile=""Topic.md"" sourceStartLineNumber=""4"">list member 2</li>
</ul>
<hr sourceFile=""Topic.md"" sourceStartLineNumber=""5"" />
<p sourceFile=""Topic.md"" sourceStartLineNumber=""6""><a href=""http://spec.commonmark.org/0.27/"" sourceFile=""Topic.md"" sourceStartLineNumber=""6"">Two Line Link</a></p>
";

            TestUtility.VerifyMarkup(content, expected, lineNumber: true, filePath: "Topic.md");
        }
コード例 #9
0
ファイル: RowsTest.cs プロジェクト: zhamppx97/docfx
        public void RowTest_WithColumnsWithSpans()
        {
            var source   = @":::row:::
    :::column span=""2"":::
        This is where your content goes.
    :::column-end:::
    :::column:::
        This is where your content goes.
    :::column-end:::
:::row-end:::
";
            var expected = @"<section class=""row"">
<div class=""column span2"">
<p>This is where your content goes.</p>
</div>
<div class=""column"">
<p>This is where your content goes.</p>
</div>
</section>
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #10
0
        public void TestSectionBlockLevel(string source)
        {
            var expected = @"<div class=""tabbedCodeSnippets"" data-resources=""OutlookServices.Calendar"">
<pre><code class=""lang-cs-i"">   var outlookClient = await CreateOutlookClientAsync(&quot;Calendar&quot;);
   var events = await outlookClient.Me.Events.Take(10).ExecuteAsync();
           foreach (var calendarEvent in events.CurrentPage)
           {
               System.Diagnostics.Debug.WriteLine(&quot;Event '{0}'.&quot;, calendarEvent.Subject);
           }
</code></pre>
<pre><code class=""lang-javascript-i"">outlookClient.me.events.getEvents().fetch().then(function(result) {
       result.currentPage.forEach(function(event) {
       console.log('Event &quot;' + event.subject + '&quot;')
   });
}, function(error)
   {
       console.log(error);
   });
</code></pre>
</div>";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #11
0
ファイル: GeneralTest.cs プロジェクト: yunair/docfx
        public void TestDfm_MultipleOptionalExtensionsEnabled()
        {
            // Confirm that multiple optional extensions can be enabled at once
            var source   = @"* Not contain a special character: &#92; ! # $ % & * + / = ? ^ &#96; { } | ~ < > ( ) ' ; : , [ ] "" @ _

Term 1
:   Definition 1";
            var expected = @"<ul class=""contains-task-list"">
<li class=""task-list-item"">Not contain a special character: \ ! # $ % &amp; * + / = ? ^ ` { } | ~ &lt; &gt; ( ) ' ; : , <input disabled=""disabled"" type=""checkbox"" /> &quot; @ _</li>
</ul>

<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
</dl>
";

            TestUtility.VerifyMarkup(source, expected, optionalExtensions: new List <string>
            {
                "tasklists",
                "definitionlists"
            });
        }
コード例 #12
0
        public void CodeSnippetTagsShouldSucceedWhenDuplicateWithWarningWhenReferenced()
        {
            var content = @"// <tag1>
line1
// <tag1>
line2
// </tag1>
line3
// </TAG1>
// <tag2>
line4
// </tag2>
";

            var source = "[!code[tag1](Program.cs#Tag1)]";

            var expected = "<pre><code name=\"tag1\">line2\n</code></pre>";

            TestUtility.VerifyMarkup(source, expected, files: new Dictionary <string, string>
            {
                { "Program.cs", content },
            });
        }
コード例 #13
0
        public void TestDfmNote_NoteWithTextFollow()
        {
            var source   = @"# Note not in one line
> [!NOTE]
> hello
> world
> [!WARNING]
>   Hello world
this is also warning";
            var expected = @"<h1 id=""note-not-in-one-line"">Note not in one line</h1>
<div class=""NOTE"">
<h5>NOTE</h5>
<p>hello
world</p>
</div>
<div class=""WARNING"">
<h5>WARNING</h5>
<p>Hello world
this is also warning</p>
</div>
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #14
0
        public void ChromelessFormsTestSubmitTextRequired()
        {
            var content = @"::: form action=""create-Resource"" :::";

            TestUtility.VerifyMarkup(content, null, new[] { "invalid-form" });
        }
コード例 #15
0
        public void ChromelessFormsTestActionRequired()
        {
            var content = @"::: form submitText=""Do it"" :::";

            TestUtility.VerifyMarkup(content, null, new[] { "invalid-form" });
        }
コード例 #16
0
        public void ChromelessFormsAttributeValueRequired()
        {
            var content = @"::: form submitText :::";

            TestUtility.VerifyMarkup(content, null, new[] { "invalid-form" });
        }
コード例 #17
0
        public void ChromelessFormsAttributeEndQuotationsRequired()
        {
            var content = @"::: form submitText=""something :::";

            TestUtility.VerifyMarkup(content, null, new[] { "invalid-form" });
        }
コード例 #18
0
ファイル: GeneralTest.cs プロジェクト: saul/docfx
        public void TestAllExtentsions()
        {
            string source           = @"---
title: ""如何使用 Visual C++ 工具集报告问题 | Microsoft Docs""
ms.custom: 
ms.date: 11/04/2016
ms.reviewer: 
ms.suite: 
ms.technology:
- cpp
ms.tgt_pltfrm: 
ms.topic: article
dev_langs:
- C++
ms.assetid: ec24a49c-411d-47ce-aa4b-8398b6d3e8f6
caps.latest.revision: 8
author: corob-msft
ms.author: corob
manager: ghogen
translation.priority.mt:
- cs-cz
- pl-pl
- pt-br
- tr-tr
translationtype: Human Translation
ms.sourcegitcommit: 5c6fbfc8699d7d66c40b0458972d8b6ef0dcc705
ms.openlocfilehash: 2ea129ac94cb1ddc7486ba69280dc0390896e088

---

## Inclusion

### Block inclusion

[!include[block](~/includes/blockIncludeFile.md)]

### Inline inclusion

Token is [!include[TEXT](includes/testtoken.md)]

## Code Snippet

[!code-cs[code](~/code/code.cs#1)]

[!code-cs[code](~/code/code.cs)]

[!code-cs[Main](~/code/code.cs?highlight=3-4&range=4-7,15-20 ""This includes the whole file with lines 3-4 highlighted"")]

[test link](topic.md)

[test link1](Topics/topic.md)

<xref:Microsoft.Build.Tasks>

@Microsoft.Build.Tasks

@""Microsoft.Build.Tasks?text=Tasks""

[link_text](xref:Microsoft.Build.Tasks)

<xref:Microsoft.Build.Tasks#Anchor_1>

<xref href=""Microsoft.Build.Tasks?alt=ImmutableArray""/>

<xref:""Microsoft.Build.Tasks?alt=ImmutableArray"">

<a href=""xref:Microsoft.Build.Tasks?displayProperty=fullName""/>

## Note / Section / Video

http://your.company.abc, abc

### Note Sample

> [!NOTE]
> note content
> [!TIP]
> tip content
> [!WARNING]
> warning content
> [!IMPORTANT]
> important content
> [!CAUTION]
> caution content

### Section Sample

> [!div class=""op_single_selector""]
> * [Google](https://www.google.com)
> * [Bing](https://www.bing.com/)

### Video Sample

> [!Video https://sec.ch9.ms/ch9/4393/7d7c7df7-3f15-4a65-a2f7-3e4d0bea4393/Episode208_mid.mp4]

## CommonMark sample

- # Foo
- Bar
  ---
  baz";
            string blockIncludeFile = @"Hello World.

[!code[Main](~/code/code.cs?range=2,4-7,9-20 ""Test in include file"")]

Update without force build, while a.md include b.md and b.md updated.";

            string testtoken = @"terry & jack";

            string code = @"// <snippet1>
using System;

public struct Temperature
{
   private decimal temp;
   private DateTime tempDate;

   public Temperature(decimal temperature, DateTime dateAndTime)
   {
      this.temp = temperature;
      this.tempDate = dateAndTime;
   }

   public decimal Degrees
   { get { return this.temp; } }

   public DateTime Date
   { get { return this.tempDate; } }
}
// </snippet1>

#region 2
csr
#endregion";

            string expected = @"<h2 id=""inclusion"">Inclusion</h2>
<h3 id=""block-inclusion"">Block inclusion</h3>
<p>Hello World.</p>
<pre><code name=""Main"" title=""Test in include file"">using System;
public struct Temperature
{
   private decimal temp;
   private DateTime tempDate;
   public Temperature(decimal temperature, DateTime dateAndTime)
   {
      this.temp = temperature;
      this.tempDate = dateAndTime;
   }

   public decimal Degrees
   { get { return this.temp; } }

   public DateTime Date
   { get { return this.tempDate; } }
}
</code></pre>
<p>Update without force build, while a.md include b.md and b.md updated.</p>
<h3 id=""inline-inclusion"">Inline inclusion</h3>
<p>Token is terry &amp; jack</p>
<h2 id=""code-snippet"">Code Snippet</h2>
<pre><code class=""lang-cs"" name=""code"">using System;

public struct Temperature
{
   private decimal temp;
   private DateTime tempDate;

   public Temperature(decimal temperature, DateTime dateAndTime)
   {
      this.temp = temperature;
      this.tempDate = dateAndTime;
   }

   public decimal Degrees
   { get { return this.temp; } }

   public DateTime Date
   { get { return this.tempDate; } }
}
</code></pre><pre><code class=""lang-cs"" name=""code"">// &lt;snippet1&gt;
using System;

public struct Temperature
{
   private decimal temp;
   private DateTime tempDate;

   public Temperature(decimal temperature, DateTime dateAndTime)
   {
      this.temp = temperature;
      this.tempDate = dateAndTime;
   }

   public decimal Degrees
   { get { return this.temp; } }

   public DateTime Date
   { get { return this.tempDate; } }
}
// &lt;/snippet1&gt;

#region 2
csr
#endregion
</code></pre><pre><code class=""lang-cs"" name=""Main"" title=""This includes the whole file with lines 3-4 highlighted"" highlight-lines=""3-4"">public struct Temperature
{
   private decimal temp;
   private DateTime tempDate;
   public decimal Degrees
   { get { return this.temp; } }

   public DateTime Date
   { get { return this.tempDate; } }
}
</code></pre>
<p><a href=""topic.md"">test link</a></p>
<p><a href=""Topics/topic.md"">test link1</a></p>
<p><xref href=""Microsoft.Build.Tasks"" data-throw-if-not-resolved=""True"" data-raw-source=""&lt;xref:Microsoft.Build.Tasks&gt;""></xref></p>
<p><xref href=""Microsoft.Build.Tasks"" data-throw-if-not-resolved=""False"" data-raw-source=""@Microsoft.Build.Tasks""></xref></p>
<p><xref href=""Microsoft.Build.Tasks?text=Tasks"" data-throw-if-not-resolved=""False"" data-raw-source=""@&quot;Microsoft.Build.Tasks?text=Tasks&quot;""></xref></p>
<p><a href=""xref:Microsoft.Build.Tasks"">link_text</a></p>
<p><xref href=""Microsoft.Build.Tasks#Anchor_1"" data-throw-if-not-resolved=""True"" data-raw-source=""&lt;xref:Microsoft.Build.Tasks#Anchor_1&gt;""></xref></p>
<xref href=""Microsoft.Build.Tasks?alt=ImmutableArray""/>
<p><xref href=""Microsoft.Build.Tasks?alt=ImmutableArray"" data-throw-if-not-resolved=""True"" data-raw-source=""&lt;xref:&quot;Microsoft.Build.Tasks?alt=ImmutableArray&quot;&gt;""></xref></p>
<a href=""xref:Microsoft.Build.Tasks?displayProperty=fullName""/>
<h2 id=""note--section--video"">Note / Section / Video</h2>
<p><a href=""http://your.company.abc"">http://your.company.abc</a>, abc</p>
<h3 id=""note-sample"">Note Sample</h3>
<div class=""NOTE"">
<h5>NOTE</h5>
<p>note content</p>
</div>
<div class=""TIP"">
<h5>TIP</h5>
<p>tip content</p>
</div>
<div class=""WARNING"">
<h5>WARNING</h5>
<p>warning content</p>
</div>
<div class=""IMPORTANT"">
<h5>IMPORTANT</h5>
<p>important content</p>
</div>
<div class=""CAUTION"">
<h5>CAUTION</h5>
<p>caution content</p>
</div>
<h3 id=""section-sample"">Section Sample</h3>
<div class=""op_single_selector"">
<ul>
<li><a href=""https://www.google.com"">Google</a></li>
<li><a href=""https://www.bing.com/"">Bing</a></li>
</ul>
</div>
<h3 id=""video-sample"">Video Sample</h3>
<div class=""embeddedvideo""><iframe src=""https://sec.ch9.ms/ch9/4393/7d7c7df7-3f15-4a65-a2f7-3e4d0bea4393/Episode208_mid.mp4"" frameborder=""0"" allowfullscreen=""true""></iframe></div>
<h2 id=""commonmark-sample"">CommonMark sample</h2>
<ul>
<li><h1 id=""foo"">Foo</h1>
</li>
<li><h2 id=""bar"">Bar</h2>
baz</li>
</ul>
";

            TestUtility.VerifyMarkup(source, expected, files: new Dictionary <string, string>
            {
                { "includes/blockIncludeFile.md", blockIncludeFile },
                { "includes/testtoken.md", testtoken },
                { "code/code.cs", code }
            });
        }
コード例 #19
0
ファイル: VideoTest.cs プロジェクト: wwhitehead/docfx
 public void VideoTestBlock_InvalidVideo(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected, errors: new[] { "invalid-video" });
 }
コード例 #20
0
ファイル: VideoTest.cs プロジェクト: wwhitehead/docfx
 public void VideoTestBlockGeneral(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected);
 }
コード例 #21
0
ファイル: RenderZoneTest.cs プロジェクト: xuan2261/docfx
        public void KitchenSink()
        {
            //arrange
            var content = @"# Article 2

Shared content.

## Section 1

Shared content.

::: zone target=""chromeless""
## Section for chromeless only

Some chromeless-specific content here...

::: nested moniker zone is not allowed. So this line is in plain text.
Inline ::: should not end moniker zone.

::: zone-end

## Section 2

Shared content.

:::  zone  pivot=""foo""
a pivot
:::    zone-end

:::  zone  pivot="" foo,bar ""    target=""docs""
a pivot with target 
:::    zone-end

::: zone target=""docs"" pivot=""csharp7-is-great""
hello
::: zone-end
";

            // assert
            var expected = @"<h1 id=""article-2"" sourceFile=""fake.md"" sourceStartLineNumber=""1"">Article 2</h1>
<p sourceFile=""fake.md"" sourceStartLineNumber=""3"">Shared content.</p>
<h2 id=""section-1"" sourceFile=""fake.md"" sourceStartLineNumber=""5"">Section 1</h2>
<p sourceFile=""fake.md"" sourceStartLineNumber=""7"">Shared content.</p>
<div class=""zone has-target"" data-target=""chromeless"" sourceFile=""fake.md"" sourceStartLineNumber=""9"">
<h2 id=""section-for-chromeless-only"" sourceFile=""fake.md"" sourceStartLineNumber=""10"">Section for chromeless only</h2>
<p sourceFile=""fake.md"" sourceStartLineNumber=""12"">Some chromeless-specific content here...</p>
<p sourceFile=""fake.md"" sourceStartLineNumber=""14"">::: nested moniker zone is not allowed. So this line is in plain text.
Inline ::: should not end moniker zone.</p>
</div>
<h2 id=""section-2"" sourceFile=""fake.md"" sourceStartLineNumber=""19"">Section 2</h2>
<p sourceFile=""fake.md"" sourceStartLineNumber=""21"">Shared content.</p>
<div class=""zone has-pivot"" data-pivot=""foo"" sourceFile=""fake.md"" sourceStartLineNumber=""23"">
<p sourceFile=""fake.md"" sourceStartLineNumber=""24"">a pivot</p>
</div>
<div class=""zone has-target has-pivot"" data-target=""docs"" data-pivot=""foo bar"" sourceFile=""fake.md"" sourceStartLineNumber=""27"">
<p sourceFile=""fake.md"" sourceStartLineNumber=""28"">a pivot with target</p>
</div>
<div class=""zone has-target has-pivot"" data-target=""docs"" data-pivot=""csharp7-is-great"" sourceFile=""fake.md"" sourceStartLineNumber=""31"">
<p sourceFile=""fake.md"" sourceStartLineNumber=""32"">hello</p>
</div>
";

            TestUtility.VerifyMarkup(content, expected, lineNumber: true, filePath: "fake.md");
        }
コード例 #22
0
ファイル: GeneralTest.cs プロジェクト: saul/docfx
 public void TestDfmInGeneral(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected);
 }
コード例 #23
0
        public void ImageTestBlockGeneral()
        {
            var source = @":::image type=""content"" source=""example.jpg"" alt-text=""example"":::

:::image type=""content"" source=""example.jpg"" alt-text=""example"" border=""false"":::

:::image type=""content"" source=""example.jpg"" alt-text=""example"" lightbox=""example-expanded.jpg"":::

:::image type=""content"" source=""example.jpg"" alt-text=""example"" lightbox=""example-expanded.jpg"" border=""false"":::

:::image type=""icon"" source=""green-checkmark.png""::: |  |  |  |

|Capability   | Admin  | Member  | Contributor  | Viewer |
|---|---|---|---|---|
| Update and delete the workspace.  |  |   |   |   | 
| Add/remove people, including other admins.  | :::image type=""icon"" source=""green-checkmark.png"":::  |   |   |   |
| Add members or others with lower permissions.  |  X | X  |  |   |";

            var expected = @"<p class=""mx-imgBorder"">
<img src=""example.jpg"" alt=""example"">
</p>
<p>
<img src=""example.jpg"" alt=""example"">
</p>
<p class=""mx-imgBorder"">
<a href=""example-expanded.jpg#lightbox"" data-linktype=""relative-path"">
<img src=""example.jpg"" alt=""example"">
</a>
</p>
<p>
<a href=""example-expanded.jpg#lightbox"" data-linktype=""relative-path"">
<img src=""example.jpg"" alt=""example"">
</a>
</p>
<p>
<img src=""green-checkmark.png"" role=""presentation"">
</p>
<table>
<thead>
<tr>
<th>Capability</th>
<th>Admin</th>
<th>Member</th>
<th>Contributor</th>
<th>Viewer</th>
</tr>
</thead>
<tbody>
<tr>
<td>Update and delete the workspace.</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Add/remove people, including other admins.</td>
<td><img src=""green-checkmark.png"" role=""presentation"">
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Add members or others with lower permissions.</td>
<td>X</td>
<td>X</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #24
0
        public void CodeTestBlockGeneral(string source, string expected)
        {
            var filename = string.Empty;
            var content  = string.Empty;

            // arrange
            if (source.Contains("source.cs"))
            {
                filename = "source.cs";
                content  = contentCSharp;
            }
            else if (source.Contains("source2.cs"))
            {
                filename = "source2.cs";
                content  = contentCharpRegion;
            }
            else if (source.Contains("asp.cshtml"))
            {
                filename = "asp.cshtml";
                content  = contentASPNet;
            }
            else if (source.Contains("source.vb"))
            {
                filename = "source.vb";
                content  = contentVB;
            }
            else if (source.Contains("source.cpp"))
            {
                filename = "source.cpp";
                content  = contentCPP;
            }
            else if (source.Contains("source.sql"))
            {
                filename = "source.sql";
                content  = contentSQL;
            }
            else if (source.Contains("source.py"))
            {
                filename = "source.py";
                content  = contentPython;
            }
            else if (source.Contains("source.bat"))
            {
                filename = "source.bat";
                content  = contentBatch;
            }
            else if (source.Contains("source.erl"))
            {
                filename = "source.erl";
                content  = contentErlang;
            }
            else if (source.Contains("source.lsp"))
            {
                filename = "source.lsp";
                content  = contentLisp;
            }

            // act

            // assert
            TestUtility.VerifyMarkup(source, expected, files: new Dictionary <string, string>
            {
                { filename, content }
            });
        }
コード例 #25
0
 public void TestSectionNoteInBlockQuote(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected);
 }
コード例 #26
0
        public void TestSectionNoteMixture(string source)
        {
            var expected = "<blockquote>\n<p>this is blockquote</p>\n<p>this line is also in the before blockquote</p>\n</blockquote>\n<div class=\"NOTE\">\n<h5>NOTE</h5>\n<p>This is note text</p>\n</div>\n<div class=\"WARNING\">\n<h5>WARNING</h5>\n<p>This is warning text</p>\n</div>\n<div class=\"a\" id=\"diva\">\n<p>this is div with class a and id diva\ntext also in div</p>\n</div>\n<div class=\"b\" cause=\"divb\">\n<p>this is div with class b and cause divb</p>\n</div>\n<div class=\"IMPORTANT\">\n<h5>IMPORTANT</h5>\n<p>This is important text follow div</p>\n</div>\n";

            TestUtility.VerifyMarkup(source, expected);
        }
コード例 #27
0
        public void TestDfmFencesInlineLevel()
        {
            var root = @"
| Code in table | Header1 |
 ----------------- | ----------------------------
| [!code-FakeREST[REST](api.json)] | [!Code-FakeREST-i[REST-i](api.json ""This is root"")]
| [!CODE[No Language](api.json)] | [!code-js[empty](api.json)]
";

            var apiJsonContent = @"
{
   ""method"": ""GET"",
   ""resourceFormat"": ""https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End"",
   ""requestUrl"": ""https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End"",
   ""requestHeaders"": {
                ""Accept"": ""application/json""
   }
}";

            const string expected = @"<table>
<thead>
<tr>
<th>Code in table</th>
<th>Header1</th>
</tr>
</thead>
<tbody>
<tr>
<td><pre><code class=""lang-FakeREST"" name=""REST"">
{
   &quot;method&quot;: &quot;GET&quot;,
   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestHeaders&quot;: {
                &quot;Accept&quot;: &quot;application/json&quot;
   }
}
</code></pre></td>
<td><pre><code class=""lang-FakeREST-i"" name=""REST-i"" title=""This is root"">
{
   &quot;method&quot;: &quot;GET&quot;,
   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestHeaders&quot;: {
                &quot;Accept&quot;: &quot;application/json&quot;
   }
}
</code></pre></td>
</tr>
<tr>
<td><pre><code name=""No Language"">
{
   &quot;method&quot;: &quot;GET&quot;,
   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestHeaders&quot;: {
                &quot;Accept&quot;: &quot;application/json&quot;
   }
}
</code></pre></td>
<td><pre><code class=""lang-js"" name=""empty"">
{
   &quot;method&quot;: &quot;GET&quot;,
   &quot;resourceFormat&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestUrl&quot;: &quot;https://outlook.office.com/api/v1.0/me/events?$select=Subject,Organizer,Start,End&quot;,
   &quot;requestHeaders&quot;: {
                &quot;Accept&quot;: &quot;application/json&quot;
   }
}
</code></pre></td>
</tr>
</tbody>
</table>
";

            TestUtility.VerifyMarkup(root, expected, files: new Dictionary <string, string>
            {
                { "api.json", apiJsonContent },
            });
        }
コード例 #28
0
 public void TestSectionCornerCase(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected);
 }
コード例 #29
0
ファイル: TabGroupTest.cs プロジェクト: dlech/docfx
 private static void TestMarkupInGeneral(string source, string expected)
 {
     TestUtility.VerifyMarkup(source, expected, lineNumber: true, filePath: "Topic.md");
 }