Skip to content

Commit

Permalink
Pull in MDN documentation with attribution.
Browse files Browse the repository at this point in the history
Collect documentations on CSS properties and compile into
mdn-documentation.js. Certain properties are excluded because of
inaccurency.

- Fix microsoft/vscode#46866
- Fix microsoft/vscode#46423
- Fix microsoft/vscode#27204
  • Loading branch information
octref committed Apr 23, 2018
1 parent 37c4090 commit f40b850
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 7,620 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ License
(MIT License)

Copyright 2016, Microsoft

With the exceptions of,

- `build/mdn-documentation.js`, which is built upon content from [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web)
and distributed under CC BY-SA 2.5.
15 changes: 14 additions & 1 deletion build/mdn-data-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
const path = require('path')
const fs = require('fs')

const mdnDocumentations = require('./mdn-documentation')

const mdnExcludedProperties = [
'--*', // custom properties
'gap', // grid-gap
'row-gap', // grid-row-gap
'image-resolution', // https://www.w3.org/TR/css-images-4/#propdef-image-resolution
]

function buildPropertiesWithMDNData(vscProperties) {
const propertyMap = {}

Expand All @@ -22,6 +31,10 @@ function buildPropertiesWithMDNData(vscProperties) {
}
}

mdnExcludedProperties.forEach(p => {
delete allMDNProperties[p]
})

/**
* 1. Go through VSC properties. For each entry that has a matching entry in MDN, merge both entry.
*/
Expand All @@ -45,7 +58,7 @@ function buildPropertiesWithMDNData(vscProperties) {
if (!propertyMap[pn]) {
propertyMap[pn] = {
name: pn,
description: '',
desc: mdnDocumentations[pn] ? mdnDocumentations[pn] : '',
restriction: 'none',
...extractMDNProperties(allMDNProperties[pn])
}
Expand Down
Loading

0 comments on commit f40b850

Please sign in to comment.