Skip to content

HTML ➡️ Markdown: Web/JavaScript/Reference/Global_Objects/Map #6194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

Gregoor
Copy link
Contributor

@Gregoor Gregoor commented Jun 21, 2021

subset of #5193

We are thinking of starting with this slice as a safe first test of Markdowning. This PR would basically check Number 5 from the list here #5808

I reviewed these pages last week and they were visually identical (apart from the missing styling that having <var>s added). We did do some more fixing for the converter but that should not have these pages affected.

I also did do a manual change, which is stripping the span.seoSummary tag, which is not yet being stripped due to a bug (fix in progress).

Conversion Report (basically only crying about tables)

Report from 6/21/2021, 4:44:14 PM

Top 20 unhandled elements

  • tr (8)
  • td (8)
  • th[scope="row"] (8)
  • table.standard-table (1)

Details per Document

/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

Invalid AST transformations

tr (54:5) => tableRow
type: "html"
value: "<th scope=\"row\"></th>"
td (65:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 1
shouldWrap: true
children: 
  type: "text"
  value: "An "
  type: "inlineCode"
  value: "Object"
  type: "text"
  value: " has a prototype, so it contains default keys that could collide with your own keys if you're not careful.",type: "blockquote"
children: 
  type: "paragraph"
  children: 
    type: "strong"
    children: 
      type: "text"
      value: "Note:"
    type: "text"
    value: " As of ES5, this can be bypassed by using {{anN4cmVmKCJPYmplY3QuY3JlYXRlIiwgIk9iamVjdC5jcmVhdGUobnVsbCkiKQ==}}, but this is seldom done."
tr (61:5) => tableRow
type: "html"
value: "<th scope=\"row\">Accidental Keys</th>",type: "html"
value: "<td><p>An <code>Object</code> has a prototype, so it contains default keys that could\ncollide with your own keys if you're not careful.</p><div class=\"notecard note\"><p><strong>Note:</strong> As of ES5, this can be bypassed by using\n{{anN4cmVmKCJPYmplY3QuY3JlYXRlIiwgIk9iamVjdC5jcmVhdGUobnVsbCkiKQ==}}, but this is seldom done.</p></div></td>"
tr (76:5) => tableRow
type: "html"
value: "<th scope=\"row\">Key Types</th>"
td (85:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 3
shouldWrap: true
children: 
  type: "text"
  value: "The keys in "
  type: "inlineCode"
  value: "Map"
  type: "text"
  value: " are ordered in a simple, straightforward way: A "
  type: "inlineCode"
  value: "Map"
  type: "text"
  value: " object iterates entries, keys, and values in the order of entry insertion."
td (90:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 3
shouldWrap: true
children: 
  type: "text"
  value: "Although the keys of an ordinary "
  type: "inlineCode"
  value: "Object"
  type: "text"
  value: " are ordered now, this was not always the case, and the order is complex. As a result, it's best not to rely on property order.",type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 3
shouldWrap: true
children: 
  type: "text"
  value: "The order was first defined for own properties only in ECMAScript 2015; ECMAScript 2020 defines order for inherited properties as well. See the "
  type: "link"
  title: 

  url: "https://tc39.es/ecma262/#sec-ordinaryownpropertykeys"
  children: 
    type: "text"
    value: "OrdinaryOwnPropertyKeys"
  type: "text"
  value: " and "
  type: "link"
  title: 

  url: "https://tc39.es/ecma262/#sec-enumerate-object-properties"
  children: 
    type: "text"
    value: "EnumerateObjectProperties"
  type: "text"
  value: " abstract specification operations. But note that no single mechanism iterates "
  type: "strong"
  children: 
    type: "text"
    value: "all"
  type: "text"
  value: " of an object's properties; the various mechanisms each include different subsets of properties. ({{anN4cmVmKCJTdGF0ZW1lbnRzL2Zvci4uLmluIiwKICAgICAgICAgICJmb3ItaW4iKQ==}} includes only enumerable string-keyed properties; {{anN4cmVmKCJPYmplY3Qua2V5cyIp}} includes only own, enumerable, string-keyed properties; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyIp}} includes own, string-keyed properties even if non-enumerable; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzIik=}} does the same for just "
  type: "inlineCode"
  value: "Symbol"
  type: "text"
  value: "-keyed properties, etc.)"
tr (83:5) => tableRow
type: "html"
value: "<th scope=\"row\">Key Order</th>",type: "html"
value: "<td><p>The keys in <code>Map</code> are ordered in a simple, straightforward way: A\n<code>Map</code> object iterates entries, keys, and values in the order of entry\ninsertion.</p></td>",type: "html"
value: "<td><p>Although the keys of an ordinary <code>Object</code> are ordered now, this was not always the case, and the order is complex. As a result, it's best not to rely\non property order.</p><p>The order was first defined for own properties only in ECMAScript 2015;\nECMAScript 2020 defines order for inherited properties as well. See the <a href=\"https://tc39.es/ecma262/#sec-ordinaryownpropertykeys\">OrdinaryOwnPropertyKeys</a>\nand <a href=\"https://tc39.es/ecma262/#sec-enumerate-object-properties\">EnumerateObjectProperties</a>\nabstract specification operations. But note that no single mechanism iterates\n<strong>all</strong> of an object's properties; the various mechanisms each\ninclude different subsets of properties. ({{anN4cmVmKCJTdGF0ZW1lbnRzL2Zvci4uLmluIiwKICAgICAgICAgICJmb3ItaW4iKQ==}} includes only enumerable string-keyed properties;\n{{anN4cmVmKCJPYmplY3Qua2V5cyIp}} includes only own, enumerable, string-keyed\nproperties; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyIp}} includes own, string-keyed\nproperties even if non-enumerable; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzIik=}}\ndoes the same for just <code>Symbol</code>-keyed properties, etc.)</p></td>"
tr (108:5) => tableRow
type: "html"
value: "<th scope=\"row\"><p>Size</p></th>"
td (121:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 5
shouldWrap: true
children: 
  type: "inlineCode"
  value: "Object"
  type: "text"
  value: " does not implement an "
  type: "link"
  title: 

  url: "/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol"
  children: 
    type: "text"
    value: "iteration protocol"
  type: "text"
  value: ", and so objects are not directly iterable using the JavaScript "
  type: "link"
  title: 

  url: "/en-US/docs/Web/JavaScript/Reference/Statements/for...of"
  children: 
    type: "text"
    value: "for...of"
  type: "text"
  value: " statement (by default).",type: "blockquote"
children: 
  type: "paragraph"
  children: 
    type: "strong"
    children: 
      type: "text"
      value: "Note:"
  type: "list"
  ordered: false
  start: 

  spread: false
  children: 
    type: "listItem"
    spread: false
    children: 
      type: "paragraph"
      children: 
        type: "text"
        value: "An object can implement the iteration protocol, or you can get an iterable for an object using "
        type: "link"
        title: 

        url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys"
        children: 
          type: "inlineCode"
          value: "Object.keys"
        type: "text"
        value: " or "
        type: "link"
        title: 

        url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries"
        children: 
          type: "inlineCode"
          value: "Object.entries"
        type: "text"
        value: "."
    type: "listItem"
    spread: false
    children: 
      type: "paragraph"
      children: 
        type: "text"
        value: "The "
        type: "link"
        title: 

        url: "/en-US/docs/Web/JavaScript/Reference/Statements/for...in"
        children: 
          type: "text"
          value: "for...in"
        type: "text"
        value: " statement allows you to iterate over the "
        type: "emphasis"
        children: 
          type: "text"
          value: "enumerable"
        type: "text"
        value: " properties of an object."
tr (116:5) => tableRow
type: "html"
value: "<th scope=\"row\">Iteration</th>",type: "html"
value: "<td><p><code>Object</code> does not implement an <a href=\"/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol\">iteration\nprotocol</a>, and so objects are not directly iterable using the JavaScript <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...of\">for...of</a>\nstatement (by default).</p><div class=\"notecard note\"><p><strong>Note:</strong></p><ul><li>An object can implement the iteration protocol, or you can get an iterable\nfor an object using <a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\"><code>Object.keys</code></a> or <a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries\"><code>Object.entries</code></a>.</li><li>The <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...in\">for...in</a>\nstatement allows you to iterate over the <em>enumerable</em> properties of\nan object.</li></ul></div></td>"
td (147:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 6
shouldWrap: true
children: 
  type: "text"
  value: "Performs better in scenarios involving frequent additions and removals of key-value pairs."
td (151:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 6
shouldWrap: true
children: 
  type: "text"
  value: "Not optimized for frequent additions and removals of key-value pairs."
tr (145:5) => tableRow
type: "html"
value: "<th scope=\"row\">Performance</th>",type: "html"
value: "<td><p>Performs better in scenarios involving frequent additions and removals of\nkey-value pairs.</p></td>",type: "html"
value: "<td><p>Not optimized for frequent additions and removals of key-value pairs.</p></td>"
td (157:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 7
shouldWrap: true
children: 
  type: "text"
  value: "No native support for serialization or parsing.",type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 7
shouldWrap: true
children: 
  type: "text"
  value: "(But you can build your own serialization and parsing support for "
  type: "inlineCode"
  value: "Map"
  type: "text"
  value: " by using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}} with its "
  type: "emphasis"
  children: 
    type: "text"
    value: "replacer"
  type: "text"
  value: " argument, and by using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}} with its "
  type: "emphasis"
  children: 
    type: "text"
    value: "reviver"
  type: "text"
  value: " argument. See the Stack Overflow question "
  type: "link"
  title: 

  url: "https://stackoverflow.com/q/29085197/"
  children: 
    type: "text"
    value: "How do you JSON.stringify an ES6 Map?"
  type: "text"
  value: ")."
td (161:7) => tableCell
type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 7
shouldWrap: true
children: 
  type: "text"
  value: "Native support for serialization from {{anN4cmVmKCJPYmplY3QiKQ==}} to JSON, using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}}.",type: "paragraph"
summary: "The Map object holds key-value\n    pairs and remembers the original insertion order of the keys. Any value (both\n  objects and {{Z2xvc3NhcnkoIlByaW1pdGl2ZSIsICJwcmltaXRpdmUgdmFsdWVzIik=}}) may be used as either a key\n  or a value."
rowIndex: 7
shouldWrap: true
children: 
  type: "text"
  value: "Native support for parsing from JSON to {{anN4cmVmKCJPYmplY3QiKQ==}}, using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}}."
tr (155:5) => tableRow
type: "html"
value: "<th scope=\"row\">Serialization and parsing</th>",type: "html"
value: "<td><p>No native support for serialization or parsing.</p><p>(But you can build your own serialization and parsing support for <code>Map</code> by using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}} with its <em>replacer</em> argument, and by using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}} with its <em>reviver</em> argument. See the Stack Overflow question <a href=\"https://stackoverflow.com/q/29085197/\">How do you JSON.stringify an ES6 Map?</a>).</p></td>",type: "html"
value: "<td><p>Native support for serialization from {{anN4cmVmKCJPYmplY3QiKQ==}} to JSON, using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}}.</p><p>Native support for parsing from JSON to {{anN4cmVmKCJPYmplY3QiKQ==}}, using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}}.</p></td>"
table.standard-table (52:1) => table
type: "html"
value: "<tr><th scope=\"row\"></th><th scope=\"col\">Map</th><th scope=\"col\">Object</th></tr>",type: "html"
value: "<tr><th scope=\"row\">Accidental Keys</th><td>A <code>Map</code> does not contain any keys by default. It only contains what\nis explicitly put into it.</td><td><p>An <code>Object</code> has a prototype, so it contains default keys that could\ncollide with your own keys if you're not careful.</p><div class=\"notecard note\"><p><strong>Note:</strong> As of ES5, this can be bypassed by using\n{{anN4cmVmKCJPYmplY3QuY3JlYXRlIiwgIk9iamVjdC5jcmVhdGUobnVsbCkiKQ==}}, but this is seldom done.</p></div></td></tr>",type: "html"
value: "<tr><th scope=\"row\">Key Types</th><td>A <code>Map</code>'s keys can be any value (including functions, objects, or any\nprimitive).</td><td>The keys of an <code>Object</code> must be either a {{anN4cmVmKCJTdHJpbmciKQ==}} or a\n{{anN4cmVmKCJTeW1ib2wiKQ==}}.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Key Order</th><td><p>The keys in <code>Map</code> are ordered in a simple, straightforward way: A\n<code>Map</code> object iterates entries, keys, and values in the order of entry\ninsertion.</p></td><td><p>Although the keys of an ordinary <code>Object</code> are ordered now, this was not always the case, and the order is complex. As a result, it's best not to rely\non property order.</p><p>The order was first defined for own properties only in ECMAScript 2015;\nECMAScript 2020 defines order for inherited properties as well. See the <a href=\"https://tc39.es/ecma262/#sec-ordinaryownpropertykeys\">OrdinaryOwnPropertyKeys</a>\nand <a href=\"https://tc39.es/ecma262/#sec-enumerate-object-properties\">EnumerateObjectProperties</a>\nabstract specification operations. But note that no single mechanism iterates\n<strong>all</strong> of an object's properties; the various mechanisms each\ninclude different subsets of properties. ({{anN4cmVmKCJTdGF0ZW1lbnRzL2Zvci4uLmluIiwKICAgICAgICAgICJmb3ItaW4iKQ==}} includes only enumerable string-keyed properties;\n{{anN4cmVmKCJPYmplY3Qua2V5cyIp}} includes only own, enumerable, string-keyed\nproperties; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyIp}} includes own, string-keyed\nproperties even if non-enumerable; {{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzIik=}}\ndoes the same for just <code>Symbol</code>-keyed properties, etc.)</p></td></tr>",type: "html"
value: "<tr><th scope=\"row\"><p>Size</p></th><td>The number of items in a <code>Map</code> is easily retrieved from its\n{{anN4cmVmKCJNYXAucHJvdG90eXBlLnNpemUiLCAic2l6ZSIp}} property.</td><td>The number of items in an <code>Object</code> must be determined manually.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Iteration</th><td>A <code>Map</code> is an <a href=\"/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\">iterable</a>, so it can be\ndirectly iterated.</td><td><p><code>Object</code> does not implement an <a href=\"/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol\">iteration\nprotocol</a>, and so objects are not directly iterable using the JavaScript <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...of\">for...of</a>\nstatement (by default).</p><div class=\"notecard note\"><p><strong>Note:</strong></p><ul><li>An object can implement the iteration protocol, or you can get an iterable\nfor an object using <a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\"><code>Object.keys</code></a> or <a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries\"><code>Object.entries</code></a>.</li><li>The <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...in\">for...in</a>\nstatement allows you to iterate over the <em>enumerable</em> properties of\nan object.</li></ul></div></td></tr>",type: "html"
value: "<tr><th scope=\"row\">Performance</th><td><p>Performs better in scenarios involving frequent additions and removals of\nkey-value pairs.</p></td><td><p>Not optimized for frequent additions and removals of key-value pairs.</p></td></tr>",type: "html"
value: "<tr><th scope=\"row\">Serialization and parsing</th><td><p>No native support for serialization or parsing.</p><p>(But you can build your own serialization and parsing support for <code>Map</code> by using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}} with its <em>replacer</em> argument, and by using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}} with its <em>reviver</em> argument. See the Stack Overflow question <a href=\"https://stackoverflow.com/q/29085197/\">How do you JSON.stringify an ES6 Map?</a>).</p></td><td><p>Native support for serialization from {{anN4cmVmKCJPYmplY3QiKQ==}} to JSON, using {{anN4cmVmKCJKU09OLnN0cmluZ2lmeSgpIik=}}.</p><p>Native support for parsing from JSON to {{anN4cmVmKCJPYmplY3QiKQ==}}, using {{anN4cmVmKCJKU09OLnBhcnNlKCkiKQ==}}.</p></td></tr>"

Missing conversion rules

  • th[scope="row"] (55:7)
  • th[scope="row"] (62:7)
  • th[scope="row"] (77:7)
  • th[scope="row"] (84:7)
  • th[scope="row"] (109:7)
  • th[scope="row"] (117:7)
  • th[scope="row"] (146:7)
  • th[scope="row"] (156:7)

@Gregoor Gregoor requested a review from a team as a code owner June 21, 2021 14:53
@Gregoor Gregoor requested review from wbamberg and removed request for a team June 21, 2021 14:53
@github-actions
Copy link
Contributor

github-actions bot commented Jun 21, 2021

Preview URLs

Flaws

None! 🎉

External URLs

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
Title: Map
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get
Title: Map.prototype.get()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@species
Title: get Map[@@species]
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@iterator
Title: Map.prototype[@@iterator]()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach
Title: Map.prototype.forEach()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set
Title: Map.prototype.set()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear
Title: Map.prototype.clear()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete
Title: Map.prototype.delete()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has
Title: Map.prototype.has()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size
Title: Map.prototype.size
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries
Title: Map.prototype.entries()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/Map
Title: Map() constructor
on GitHub


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values
Title: Map.prototype.values()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys
Title: Map.prototype.keys()
on GitHub

No new external URLs


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@toStringTag
Title: Map.prototype[@@toStringTag]
on GitHub

No new external URLs

(this comment was updated 2021-06-22 12:20:33.053424)

title: 'Map.prototype[@@iterator]()'
slug: Web/JavaScript/Reference/Global_Objects/Map/@@iterator
tags:
- ECMAScript 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the script also indent tags that are at the beginning of the line? (like it is in the next file)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that is just an artifact of the given frontmatter being formatted that way. That said, I have heard interest in adding prettier to the content tooling, which can also handle the YAML in the frontmatter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the formatting you get when you save a document through the API?
I don't know if a human typed these but I think I've seen that when I apply the fixable flaws, it writes the tags with indentation.
So if someone someday presses the "Fix fixable flaws" and it goes through the fm API, will it come out like you have it here in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, the way we write the front-matter actually has nothing to do with fm. It's as simple as this: https://github.com/mdn/yari/blob/fd7b368a9a0825c0ae9bcfa028461b678865453e/content/document.js#L125

yaml.dump(saveMetadata)

And that uses indentation:

> const yaml = require("js-yaml");
undefined
> console.log(yaml.dump({tags: ['Foo', 'Bar']}))
tags:
  - Foo
  - Bar

Therefore, next time someone touches this file, to do something like fixing fixable flaws, it'll cause a 6 lines diff just for indenting the tags.

@peterbe
Copy link
Contributor

peterbe commented Jun 21, 2021

I'm not a reviewer but I think we should fix the h2m so that when it writes the front-matter back into index.md files it should be written the same way that the Document.saveFile() does in content/document.js.

@Gregoor
Copy link
Contributor Author

Gregoor commented Jun 21, 2021

I created an issue for it over in Yari mdn/yari#4069
I don't think it's blocker for this small PR but would be nice to get in before we do more files

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked at the MD sources for this and the built pages, and they all look great. I also did a bit of playing with introducing flaws and they get picked up too.

Awesome work @Gregoor !

@wbamberg wbamberg requested a review from Rumyra June 21, 2021 22:47
@Gregoor Gregoor requested review from a team as code owners June 22, 2021 12:16
@Gregoor Gregoor requested a review from a team June 22, 2021 12:16
@Gregoor Gregoor requested a review from a team as a code owner June 22, 2021 12:16
@Gregoor Gregoor requested a review from a team June 22, 2021 12:16
@Gregoor Gregoor requested a review from a team as a code owner June 22, 2021 12:16
@Gregoor Gregoor requested review from ericwbailey and removed request for a team June 22, 2021 12:16
@Gregoor Gregoor force-pushed the h2m-js-ref-glob-map branch from 107a4db to 6cd4edc Compare June 22, 2021 12:18
@Gregoor
Copy link
Contributor Author

Gregoor commented Jun 22, 2021

Days without a horrific git accients: 0

Looks like I accidently pulled in too many commits just now, while I was actually just trying to create a minimal diff for adding Peter's changes to make the YAML nicer (addressing @teoli2003's comment). I both did not achieve that and also my massive commit chain tagged a BILLION PEOPLE to review this PR. To you billions: I am sorry.

I had to force-push the last commit to undo it, which also means there is no diff to where you last reviewed Will, but converter-wise the only thing that changed is that the front-matter YAML gets dumped nicely and consistently. So there should be no additional changes needed to review (which I did see in my local diff, but yeah I botched something when pushing it up here)

@Gregoor Gregoor removed request for a team June 22, 2021 12:22
@Gregoor Gregoor removed the request for review from ericwbailey June 22, 2021 12:22
@Ryuno-Ki
Copy link
Collaborator

@Gregoor I was requested as reviewer via mdn/yari-content-svg, but this PR deals with javaScript. Any particular link to SVG here?
(30 files look a lot and my time budget does not allow for it today).

@Gregoor
Copy link
Contributor Author

Gregoor commented Jun 22, 2021

@Ryuno-Ki no need for you eyes, sorry for the accidental ping. I accidently included unrelated commits which tagged a whole bunch of people in.

Copy link
Collaborator

@Rumyra Rumyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out the pr & everything looks 👌 to me!

I say do it 🙈

@Ryuno-Ki
Copy link
Collaborator

Alright, Gregoor. It happens. Nothing to be ashamed of.

@wbamberg wbamberg merged commit a565291 into main Jun 22, 2021
@wbamberg wbamberg deleted the h2m-js-ref-glob-map branch June 22, 2021 22:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants