2016-10-13 62 views
3

自動代碼格式化(動作editor.action.format)中斷Jekyll (aka Github Pages)頁碼YAML front matter代碼格式化破解VS代碼中的Jekyll YAML前置指令

的index.html自動格式化之前:

--- 
layout: default 
title: Awesome page 
bodyClass: homepage 
permalink:/
--- 
(rest of the content) 

的index.html自動套用格式後:

--- layout: default title: Awesome page bodyClass: homepage permalink:/--- 
(rest of the content is formatted ok, regular html syntax) 

我怎麼能調補VS的代碼格式?

回答

2

要解決這個問題,你有兩個選擇:

  1. settings.json文件的HTML文件

    熄滅格式:

    「html.format .enable「:false

這會關閉HTML文件的格式設置。不理想,但完成工作。有一個GitHub Issue for this,但它似乎已關閉。

  • 考慮安裝Liquid Languages Support擴展,然後添加以下內容到settings.json

    "files.associations": { "*.html": "liquid" }

  • 這已經解決了這個問題對我來說。

    0

    我有同樣的問題。請確保您有此設置設置爲假: "editor.formatOnSave": false

    +1

    謝謝@yviedev,雖然我知道。這並不能解決問題,因爲我想爲其他文件設置自動代碼格式。 – MatFiz