sindresorhus/stringify-object

New html tagging option

Closed this issue · 1 comments

An interesting new feature would be a new boolean option that when enabled allows you to add HTML tags with class names to the result.
For example:

const obj = {
  prop1: "prop1",
  prop2: "prop2",
  action1(){
    console.log("Obj action")
  }
}
console.log(stringify(obj, , { indent: "  ", singleQuotes: false, htmlTagging: true }))

Must print:

<span class="braces braces-open">{</span> 
  <span class="property-name">prop1:</span> <span class="property-value">"prop1"</span><span class="comma">,</span>
  <span class="property-name">prop2:</span> <span class="property-value">"prop2"</span><span class="comma">,</span>
  <span class="function-name">action1()</span><span class="braces braces-open">{</span><span class="function-content">
    console.log("Obj action")
  </span><span class="braces braces-open">}</span> 
<span class="braces braces-open">}</span>

That is out of scope for this package.