<?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: mario mui</title>
    <description>The latest articles on Forem by mario mui (@mariomui).</description>
    <link>https://forem.com/mariomui</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%2F378537%2F0275215b-f2a1-42f9-a81b-93247b7f191c.jpg</url>
      <title>Forem: mario mui</title>
      <link>https://forem.com/mariomui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mariomui"/>
    <language>en</language>
    <item>
      <title>Use html5 emmet inside of markdown (VSCODE)</title>
      <dc:creator>mario mui</dc:creator>
      <pubDate>Sun, 03 May 2020 09:50:34 +0000</pubDate>
      <link>https://forem.com/mariomui/use-html5-emmet-inside-of-markdown-vscode-4hee</link>
      <guid>https://forem.com/mariomui/use-html5-emmet-inside-of-markdown-vscode-4hee</guid>
      <description>&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;p&gt;If you want a great way to view your readme markdown easily, you'd want to include a dropdown menu. Readmes can get super long.&lt;/p&gt;

&lt;p&gt;Luckily, html5 has a great way to do that via the details tag. But writing all that html5 is tedious especially since there's a thousand lists in a good readme.&lt;/p&gt;

&lt;p&gt;So how can we get html5 emmet scripts to populate markdown?&lt;/p&gt;

&lt;p&gt;The docs say you need to map the property in the emmet.includeLanguages property in settings.json.&lt;/p&gt;

&lt;p&gt;That's not the only thing you have to do because markdown doesn't share the same defaults as html.&lt;br&gt;
You need tab completion and quick suggestions. You also need emmet to not exclude markdown explicitly. Below is the file.&lt;/p&gt;

&lt;h3&gt;
  
  
  TLDR : &lt;em&gt;Below is the code necessary to get it working&lt;/em&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Set the below in your settings.json of vscode.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"editor.tabCompletion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"on"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"emmet.excludeLanguages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"emmet.includeLanguages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"html"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"[markdown]"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"editor.wordWrap"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"on"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"editor.quickSuggestions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"emmet.showSuggestionsAsSnippets"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now type &lt;code&gt;details[open=true]&amp;gt;summary&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great! This should fully expand the snippet.&lt;br&gt;
Still, it's a little wordy. &lt;br&gt;
I want a custom code snippet. Type vcdd and expand it naturally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Set the following code to the settings.json section of vscode&lt;br&gt;
&lt;code&gt;"emmet.extensionsPath": "~/SOME_DIRECTORY/"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a snippets.json in that directory defined in the previous section&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the following code inside snippets.json&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"html"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"snippets"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"vcdd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"details[open=true]&amp;gt;summary"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Great! Now every time you type in vcdd, the custom emmet snippet will trigger the snippet which will then trigger the emmet specific html snippets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Caveats&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;emmet.extensionsPath only points to the directory that snippets.json resides.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No runners watch snippets.json. In order to see a change, you need to &lt;br&gt;
settings.json to do a manual reload. Just delete a random character in your settings.json. Save it. Then add the same character back in the same place inside settingsjson. Save it. That should reload &lt;code&gt;snippets.json&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;




&lt;p&gt;&lt;a href="https://code.visualstudio.com/docs/editor/emmet#_using-custom-emmet-snippets"&gt;https://code.visualstudio.com/docs/editor/emmet#_using-custom-emmet-snippets&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Microsoft/vscode/issues/32702"&gt;https://github.com/Microsoft/vscode/issues/32702&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>emmet</category>
      <category>html</category>
    </item>
  </channel>
</rss>
