chore: extend linting of code blocks in the docs (#40245)
* chore: extend linting of code blocks in the docs * chore: combine lint:markdownlint and lint:markdown scripts
This commit is contained in:
		
					parent
					
						
							
								d6bb9b40b0
							
						
					
				
			
			
				commit
				
					
						3d2a754531
					
				
			
		
					 71 changed files with 510 additions and 286 deletions
				
			
		|  | @ -39,22 +39,44 @@ To enable this mode, GPU acceleration has to be disabled by calling the | |||
| 
 | ||||
| ## Example | ||||
| 
 | ||||
| ```javascript fiddle='docs/fiddles/features/offscreen-rendering' | ||||
| const { app, BrowserWindow } = require('electron') | ||||
| ```fiddle docs/fiddles/features/offscreen-rendering | ||||
| const { app, BrowserWindow } = require('electron/main') | ||||
| const fs = require('node:fs') | ||||
| const path = require('node:path') | ||||
| 
 | ||||
| app.disableHardwareAcceleration() | ||||
| 
 | ||||
| let win | ||||
| 
 | ||||
| app.whenReady().then(() => { | ||||
|   win = new BrowserWindow({ webPreferences: { offscreen: true } }) | ||||
| function createWindow () { | ||||
|   const win = new BrowserWindow({ | ||||
|     width: 800, | ||||
|     height: 600, | ||||
|     webPreferences: { | ||||
|       offscreen: true | ||||
|     } | ||||
|   }) | ||||
| 
 | ||||
|   win.loadURL('https://github.com') | ||||
|   win.webContents.on('paint', (event, dirty, image) => { | ||||
|     fs.writeFileSync('ex.png', image.toPNG()) | ||||
|   }) | ||||
|   win.webContents.setFrameRate(60) | ||||
|   console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`) | ||||
| } | ||||
| 
 | ||||
| app.whenReady().then(() => { | ||||
|   createWindow() | ||||
| 
 | ||||
|   app.on('activate', () => { | ||||
|     if (BrowserWindow.getAllWindows().length === 0) { | ||||
|       createWindow() | ||||
|     } | ||||
|   }) | ||||
| }) | ||||
| 
 | ||||
| app.on('window-all-closed', () => { | ||||
|   if (process.platform !== 'darwin') { | ||||
|     app.quit() | ||||
|   } | ||||
| }) | ||||
| ``` | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 David Sanders
				David Sanders