docs: improve relative link linting and fix broken (#26020)
This commit is contained in:
parent
042ebdd5b0
commit
e6f570d191
6 changed files with 14 additions and 8 deletions
|
@ -232,7 +232,7 @@ Specify ways of the inspector web socket url exposure.
|
||||||
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
|
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
|
||||||
|
|
||||||
[app]: app.md
|
[app]: app.md
|
||||||
[append-switch]: app.md#appcommandlineappendswitchswitch-value
|
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||||
[ready]: app.md#event-ready
|
[ready]: app.md#event-ready
|
||||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||||
|
|
|
@ -95,7 +95,7 @@ Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`Desktop
|
||||||
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
||||||
|
|
||||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-macos
|
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
||||||
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
|
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
|
||||||
|
|
||||||
[ipc-renderer-sendto]: #ipcrenderersendtowindowid-channel--arg1-arg2-
|
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args
|
||||||
|
|
|
@ -32,4 +32,4 @@ win.setProgressBar(0.5)
|
||||||
```
|
```
|
||||||
|
|
||||||
[taskbar-progress-image]: https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png
|
[taskbar-progress-image]: https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png
|
||||||
[setprogressbar]: ../api/browser-window.md#winsetprogressbarprogress
|
[setprogressbar]: ../api/browser-window.md#winsetprogressbarprogress-options
|
||||||
|
|
|
@ -814,6 +814,6 @@ which potential security issues are not as widely known.
|
||||||
[web-contents]: ../api/web-contents.md
|
[web-contents]: ../api/web-contents.md
|
||||||
[new-window]: ../api/web-contents.md#event-new-window
|
[new-window]: ../api/web-contents.md#event-new-window
|
||||||
[will-navigate]: ../api/web-contents.md#event-will-navigate
|
[will-navigate]: ../api/web-contents.md#event-will-navigate
|
||||||
[open-external]: ../api/shell.md#shellopenexternalurl-options-callback
|
[open-external]: ../api/shell.md#shellopenexternalurl-options
|
||||||
[sandbox]: ../api/sandbox-option.md
|
[sandbox]: ../api/sandbox-option.md
|
||||||
[responsible-disclosure]: https://en.wikipedia.org/wiki/Responsible_disclosure
|
[responsible-disclosure]: https://en.wikipedia.org/wiki/Responsible_disclosure
|
||||||
|
|
|
@ -48,14 +48,20 @@ def getBrokenLinks(filepath):
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
regexLink = re.compile('\[(.*?)\]\((?P<links>(.*?))\)')
|
linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
|
||||||
|
referenceLinkRegex = re.compile('^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)')
|
||||||
links = []
|
links = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
matchLinks = regexLink.search(line)
|
matchLinks = linkRegexLink.search(line)
|
||||||
|
matchReferenceLinks = referenceLinkRegex.search(line)
|
||||||
if matchLinks:
|
if matchLinks:
|
||||||
relativeLink = matchLinks.group('links')
|
relativeLink = matchLinks.group('link')
|
||||||
if not str(relativeLink).startswith('http'):
|
if not str(relativeLink).startswith('http'):
|
||||||
links.append(relativeLink)
|
links.append(relativeLink)
|
||||||
|
if matchReferenceLinks:
|
||||||
|
referenceLink = matchReferenceLinks.group('link').strip('<>')
|
||||||
|
if not str(referenceLink).startswith('http'):
|
||||||
|
links.append(referenceLink)
|
||||||
|
|
||||||
for link in links:
|
for link in links:
|
||||||
sections = link.split('#')
|
sections = link.split('#')
|
||||||
|
|
Loading…
Reference in a new issue