<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: LadyNaggaga</title>
    <description>The latest articles on Forem by LadyNaggaga (@ladynaggaga).</description>
    <link>https://forem.com/ladynaggaga</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2626%2F2546640.jpeg</url>
      <title>Forem: LadyNaggaga</title>
      <link>https://forem.com/ladynaggaga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ladynaggaga"/>
    <language>en</language>
    <item>
      <title>Markdown + .NET = Interactive docs?</title>
      <dc:creator>LadyNaggaga</dc:creator>
      <pubDate>Fri, 17 May 2019 18:38:39 +0000</pubDate>
      <link>https://forem.com/ladynaggaga/markdown-net-interactive-docs-3ba2</link>
      <guid>https://forem.com/ladynaggaga/markdown-net-interactive-docs-3ba2</guid>
      <description>&lt;p&gt;My team and I have been trying to figure out ways for developers from the newbies to the more experienced that would enable them to try and explore .NET easily. Our work lead to the development of Try .NET.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Try .NET&lt;/strong&gt;: Try .NET is an interactive documentation generator for .NET Core.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try .NET Online
&lt;/h2&gt;

&lt;p&gt;When Try .NET initially launched in September 2017, on docs.microsoft.com, we executed all our code server side using Azure Container Instances. However, over the past five months, we switched our code execution client side using Blazor and Web Assembly. By moving  client side execution it allowed us to provided Try .NET to a larger audience for FREE 😃.&lt;/p&gt;

&lt;p&gt;You can see this for yourself by visiting &lt;a href="https://docs.microsoft.com/dotnet/csharp/tutorials/intro-to-csharp/hello-world?tutorial-step=5"&gt;this page&lt;/a&gt;, and opening your browser's developer tools. Under the &lt;em&gt;Console&lt;/em&gt; tab, you will see the  message &lt;code&gt;WASM:Initialized&lt;/code&gt;. Now, switch over to the &lt;em&gt;Network&lt;/em&gt; tab, and you will see all the DLLs now running on the client side. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J60JmEDa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57245063-c6d10f00-6fee-11e9-860e-ddd6327c79c5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J60JmEDa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57245063-c6d10f00-6fee-11e9-860e-ddd6327c79c5.PNG" alt="WASm"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Console Tab: WASM Initialized&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Thc3Lfig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57245056-c3d61e80-6fee-11e9-91f3-628aaa125a1f.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Thc3Lfig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57245056-c3d61e80-6fee-11e9-91f3-628aaa125a1f.PNG" alt="Network"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Network tab: DLLs&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Try .NET Offline
&lt;/h2&gt;

&lt;p&gt;It was essential for us to provide interactive documentation both online and offline. For our offline experience, it was crucial for us to create an experience that plugged into our content writers' current workflow.&lt;br&gt;
In our findings, we noticed that our content developers had two common areas they consistently used while creating developer documentation.  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; A sample project that users could download and run.&lt;/li&gt;
&lt;li&gt; Markdown files with a set of instructions, and code snippets they copied and pasted from their code base. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Try .NET enables .NET developers to create interactive markdown files with the use of the &lt;code&gt;dotnet try&lt;/code&gt; global tool.&lt;br&gt;
To make your markdown files interactive, you will need the &lt;a href="https://dotnet.microsoft.com/download/dotnet-core/3.0"&gt;.NET Core SDK&lt;/a&gt;, the &lt;a href="https://www.nuget.org/packages/dotnet-try/"&gt;dotnet try global tool&lt;/a&gt;, &lt;a href="https://visualstudio.microsoft.com/"&gt;Visual Studio&lt;/a&gt; / &lt;a href="https://code.visualstudio.com/"&gt;VS Code&lt;/a&gt;, and your repo.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4z6IMfvT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57158389-47a2c780-6db1-11e9-96ad-8c6e9ab52853.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4z6IMfvT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57158389-47a2c780-6db1-11e9-96ad-8c6e9ab52853.png" alt="interactive_doc"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  How are we doing this?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Extending Markdown&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In markdown, you use fenced code blocks to highlight code snippets. You place triple backticks before and after code blocks. You can add optional language identifiers to enable syntax highlighting in your fenced code block. For example, a C# code block would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Rain"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Hello &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s"&gt;!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;With Try .NET we have extended our code fences to include additional options.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;cs&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;Program&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cs&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csproj&lt;/span&gt; 
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Rain"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Hello &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s"&gt;!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We have created the following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;--region&lt;/code&gt; option points to a C# region. &lt;/li&gt;
&lt;li&gt;The &lt;code&gt;--source-file&lt;/code&gt; option points to a file containing source code.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;--project&lt;/code&gt; option points to a project file, which you can use to reference NuGet packages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, what we are doing here is accessing code from a &lt;code&gt;#region&lt;/code&gt; named &lt;code&gt;methods&lt;/code&gt; in a backing project &lt;code&gt;myapp&lt;/code&gt; and enabling you to run it within your markdown.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using #regions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In our markdown we extended the code fence to include a &lt;code&gt;--region&lt;/code&gt; option that points to a C# region which targets a region named &lt;code&gt;methods&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, your &lt;code&gt;Program.cs&lt;/code&gt; would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;HelloWorld&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;
                &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Rain"&lt;/span&gt;
                &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Hello&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s"&gt;!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  
                &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="n"&gt;endregion&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;dotnet try verify&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet try verify&lt;/code&gt; is a compiler for your documentation. With this command, you can make sure that every code snippet will work and is in sync with the backing project. &lt;/p&gt;

&lt;p&gt;The goal of  &lt;code&gt;dotnet try verify&lt;/code&gt; is to validate that your documentation works as intended.&lt;/p&gt;

&lt;p&gt;By running &lt;code&gt;dotnet try verify&lt;/code&gt; you will be able to detect markdown and compile errors. For example, if  I removed a semicolon from the code snippet above and renamed the region from &lt;code&gt;methods&lt;/code&gt; to &lt;code&gt;method&lt;/code&gt;, I would get the following errors. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a1xGS2aD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57272892-67a0e800-704a-11e9-83f0-c0f2181e888e.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a1xGS2aD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/2546640/57272892-67a0e800-704a-11e9-83f0-c0f2181e888e.PNG" alt="dotnettryverify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Try  the &lt;code&gt;dotnet try&lt;/code&gt; global tool
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Clone &lt;a href="https://github.com/dotnet/try"&gt;this repo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install .NET Core SDK &lt;a href="https://dotnet.microsoft.com/download/dotnet-core/3.0"&gt;3.0&lt;/a&gt; and &lt;a href="https://dotnet.microsoft.com/download/dotnet-core/2.1"&gt;2.1&lt;/a&gt;. Currently, the &lt;code&gt;dotnet try&lt;/code&gt; global tool targets 2.1. &lt;/li&gt;
&lt;li&gt;Go to your terminal &lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://www.nuget.org/packages/dotnet-try/"&gt;Try .NET tools&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;dotnet tool install --global dotnet-try --version 1.0.19266.1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Updating to the latest version of the tool is easy just run the command below&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet tool update -g dotnet-try&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Navigate to the Samples directory of this repository and, type the following  &lt;code&gt;dotnet try&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yOZQj76P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://user-images.githubusercontent.com/2546640/57164943-ab35f080-6dc3-11e9-8230-ee521e00e428.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yOZQj76P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://user-images.githubusercontent.com/2546640/57164943-ab35f080-6dc3-11e9-8230-ee521e00e428.gif" alt="dotnet try"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This will launch the browser.&lt;br&gt;
Sorry broken image link 😿. You can view the launch experience &lt;a href="https://thepracticaldev.s3.amazonaws.com/i/63cddcradm72ck2tdhhv.gif"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Try .NET is now Open Source
&lt;/h3&gt;

&lt;p&gt;Try .NET source code is now on &lt;a href="https://github.com/dotnet/try"&gt;GitHub&lt;/a&gt;! Please feel free to file any bugs reports under our issues. And if you have any feature suggestion, please submit them under our issues using the community suggestions label.&lt;/p&gt;

&lt;p&gt;To learn more about Try .NET, check out the &lt;a href="https://github.com/dotnet/try"&gt;dotnet try repo&lt;/a&gt;. Looking forward to your feedback.&lt;/p&gt;

</description>
      <category>net</category>
      <category>webassembly</category>
      <category>markdown</category>
    </item>
  </channel>
</rss>
