@@ -12,3 +12,7 @@
|
||||
.statusTable {
|
||||
table-layout: fixed !important;
|
||||
}
|
||||
|
||||
.codeBlock code {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,10 @@ export function RestOperation({ operation }: Props) {
|
||||
)}
|
||||
<div className={cx(styles.restOperation, 'd-flex flex-wrap gutter mt-4')}>
|
||||
<div className="col-md-12 col-lg-6">
|
||||
<div dangerouslySetInnerHTML={{ __html: operation.descriptionHTML }} />
|
||||
<div
|
||||
className={cx(styles.codeBlock)}
|
||||
dangerouslySetInnerHTML={{ __html: operation.descriptionHTML }}
|
||||
/>
|
||||
|
||||
{hasParameters && (
|
||||
<RestParameterTable
|
||||
|
||||
@@ -123,7 +123,8 @@ request would look like this:
|
||||
|
||||
``` shell
|
||||
curl -H 'Accept: application/vnd.github.text-match+json' \
|
||||
'{% data variables.product.api_url_pre %}/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc'
|
||||
'{% data variables.product.api_url_pre %}/search/issues?q=windows+label:bug \
|
||||
+language:python+state:open&sort=created&order=asc'
|
||||
```
|
||||
|
||||
The response will include a `text_matches` array for each search result. In the JSON below, we have two objects in the `text_matches` array.
|
||||
@@ -139,7 +140,9 @@ The second text match occurred in the `body` property of one of the issue's comm
|
||||
"object_url": "https://api.github.com/repositories/215335/issues/132",
|
||||
"object_type": "Issue",
|
||||
"property": "body",
|
||||
"fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n",
|
||||
"fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly
|
||||
distributed windows font that supports them then no problem (we can use html
|
||||
font tags) but otherwise the '(21)' style is probably better.\n",
|
||||
"matches": [
|
||||
{
|
||||
"text": "windows",
|
||||
@@ -161,7 +164,9 @@ The second text match occurred in the `body` property of one of the issue's comm
|
||||
"object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
|
||||
"object_type": "IssueComment",
|
||||
"property": "body",
|
||||
"fragment": " right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n",
|
||||
"fragment": " right after that are a bit broken IMHO :). I suppose we could
|
||||
have some hack that maxes out at whatever the font does...\n\nI'll check
|
||||
what the state of play is on Windows.\n",
|
||||
"matches": [
|
||||
{
|
||||
"text": "Windows",
|
||||
|
||||
@@ -1,10 +1,42 @@
|
||||
content | emoji
|
||||
-----------|------
|
||||
`+1` | :+1:
|
||||
`-1` | :-1:
|
||||
`laugh` | :smile:
|
||||
`confused` | :confused:
|
||||
`heart` | :heart:
|
||||
`hooray` | :tada:
|
||||
`rocket` | :rocket:
|
||||
`eyes` | :eyes:
|
||||
<table style="width:20%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left">content</th>
|
||||
<th style="text-align:left">emoji</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>+1</code></td>
|
||||
<td style="text-align:left">👍</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>-1</code></td>
|
||||
<td style="text-align:left">👎</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>laugh</code></td>
|
||||
<td style="text-align:left">😄</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>confused</code></td>
|
||||
<td style="text-align:left">😕</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>heart</code></td>
|
||||
<td style="text-align:left">❤️</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>hooray</code></td>
|
||||
<td style="text-align:left">🎉</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>rocket</code></td>
|
||||
<td style="text-align:left">🚀</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:left"><code>eyes</code></td>
|
||||
<td style="text-align:left">👀</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
1314
package-lock.json
generated
1314
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -177,7 +177,6 @@
|
||||
"esm": "^3.2.25",
|
||||
"image-size": "^1.0.1",
|
||||
"jest-puppeteer": "^5.0.4",
|
||||
"jimp": "^0.16.1",
|
||||
"puppeteer": "^9.1.1",
|
||||
"website-scraper": "^5.0.0"
|
||||
},
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
import walk from 'walk-sync'
|
||||
import jimp from 'jimp' // this is an optional dependency, install with `npm i --include=optional`
|
||||
|
||||
// iterate through enterprise images from most recent to oldest
|
||||
// check if the image in the /assets/enterprise/... directory
|
||||
// is an exact match to the assets/images in relative path and content
|
||||
// if exact match, delete the /assets/enterprise/... version
|
||||
|
||||
const enterpriseAssetDirectories = [
|
||||
'/assets/enterprise/3.0',
|
||||
'/assets/enterprise/github-ae',
|
||||
'/assets/enterprise/2.22',
|
||||
'/assets/enterprise/2.21',
|
||||
'/assets/enterprise/2.20',
|
||||
]
|
||||
|
||||
async function main() {
|
||||
for (const directory of enterpriseAssetDirectories) {
|
||||
const fullDirectoryPath = path.join(process.cwd(), directory)
|
||||
const files = walk(fullDirectoryPath, {
|
||||
includeBasePath: true,
|
||||
directories: false,
|
||||
})
|
||||
|
||||
for (const file of files) {
|
||||
// get the /assets/images file that currently exists, which
|
||||
// would be the equivalent to the enterprise asset
|
||||
const enterpriseRegex = /\/assets\/enterprise\/(2\.20|2\.21|2\.22|3\.0|github-ae)/
|
||||
const existingFileToCompare = file.replace(enterpriseRegex, '')
|
||||
const fileExt = path.extname(file)
|
||||
|
||||
// if the file in the enterprise directory is an exact copy of
|
||||
// the image in the local /assets/images directory, then we can
|
||||
// delete the enterprise image and the reference in the Markdown
|
||||
// will just work
|
||||
if (await fs.readFile(existingFileToCompare)) {
|
||||
// Buffer.compare and Jimp both return 0 if files match
|
||||
let compareResult = 1
|
||||
try {
|
||||
// Jimp gives slightly better results comparing image files
|
||||
// over using a buffer compare. Of the assets we have,
|
||||
// Jimp only supports png and gif
|
||||
if (fileExt === '.png' || fileExt === '.gif') {
|
||||
const existingImageToCompare = await jimp.read(existingFileToCompare)
|
||||
const enterpriseImage = await jimp.read(file)
|
||||
// if the diff.percent value is 0, images are identical
|
||||
const diff = await jimp.diff(existingImageToCompare, enterpriseImage)
|
||||
compareResult = diff.percent
|
||||
} else {
|
||||
const existingImageToCompare = await fs.readFile(existingFileToCompare)
|
||||
const enterpriseImage = await fs.readFile(file)
|
||||
compareResult = Buffer.compare(
|
||||
Buffer.from(existingImageToCompare),
|
||||
Buffer.from(enterpriseImage)
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(file)
|
||||
console.log(err)
|
||||
}
|
||||
if (compareResult === 0) await fs.unlink(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => console.log('Done!'))
|
||||
Reference in New Issue
Block a user