Auto open/close files, preview, terminal
You can automatically perform any of the following actions when a section is shown
- Close all open panels from the previous section.
- Open files.
- Open a Preview (including external websites).
- Open a Terminal window (including running terminal command in the background).
- Highlight lines you wish to highlight within each file.
Page - Close Tabs
Enable this to close all panels open from the previous section
Files can be opened automatically to present the panel configuration you feel is most appropriate for the reader.
The ‘Add Tab’ button allows you to create multiple lines into your configuration to address most scenarios you are likely to encounter.
You can also drag and drop files in from your project file tree to the page to add them to the Open Tabs section so that file will be opened in a tab for the reader as well as Drag and Drop on the Open Tabs area in Guides.
Please note: Image files dragged in to a page will be automatically tagged to display within the content rather than in a new panel. If you wish to have an image file open in a panel, then you would need to add it directly in the Open Tabs area. You can also drag/drop from the file tree. The correct path to the file will be included.
To open files select the file type and enter the file name(s), including the path to the file if not in the root of the project workspace.
To open multiple files in the same panel enter in the following format.
To preview your project select the 'Preview’ Type. If you wish to show an external website page, use the Preview option.
Please note, if the site you want to preview prevents embedding in an iframe then you won’t be able to use
https addresses, you would have to use an
http address instead, in which case it will open in an new browser tab.
Opening Terminal and running system commands
To open a Terminal window select the 'Terminal’ option.
You can also specify a terminal command to run when a section is displayed. For example, your Guide may run bash scripts to copy files into the root of your project from the .guides folder (which is hidden when a Guide is running) at a certain point in your Guide.
bash .guides/restore-sh prettier
You can also specify system commands in a new Terminal window like this
Highlighting Lines in your code
To highlight one or more lines within an auto-opened file, select the Highlight option and then
- Enter a piece of reference text, contained within your target file, into the Reference … field
- Specify the number of lines, from that reference point, you want to highlight
Using reference text rather than a line number means that if you insert anything into your file in the future, the line number would be invalidated, whereas the reference is much less likely to be.
If there is any potential ambiguity with this approach, simply insert a comment which is guaranteed unique and reference that.
Any combinations are acceptable and they will be opened in the order specified.
Specifying the panel number
If your layout for this page involves multiple panels, then you can also specify the panel number to display the file in.
If you leave the panel field empty, then the default panel will be chosen, which is the same as 0.
The panel order is left to right and then top to bottom and the last of all, the filetree (which you would rarely want to use).
Important : the first panel is 0, not 1.