{The `jdoc' Mode

Introduction
The jdoc mode of jedit is intended for editing multi­font hypertext documents to be viewed with the jdoc application.

This document describes the jdoc mode available with version 4.0/4.0b of jedit.

The Format Menu
As in richtext mode, the `Format' menu is available by default.  (Of course, you can change which menus are available with the Mode­Specific Preferences panel, as with any mode.)

The jdoc Menu
The `jdoc' menu has commands for applying fonts and hypertext tags to your text. The first group of commands applies various fonts to the text.  (These commands work identically to the corresponding `Level n Heading' commands, but they may be easier to access, especially if you use the keyboard shortcuts, and their names give a clearer sense of how they should be used in jdoc files.)

Make Section Title
This command creates a level 1 heading.  jdoc (and also jdoc mode) looks for level 1 headings to construct the `Sections' menu, so these are the main divisions of your document.

Make Subsection Heading
Make Subsubsection Heading
These commands create level 2 and 3 headings, useful for finer structure in your document.  (jdoc doesn't currently treat these differently from any other font, but may use them to generate a more detailed table of contents in the future.)

Make Overall Topic Title
This command makes a level 0 heading.  There should be exactly one of these, at the very top of your document.  (Nothing enforces this currently, but future versions of jdoc may use this to generate an index of documents.)

The next command doesn't affect the text at all:

Show Tags at Insert...
This command shows the text widget tags in effect at the insert point.  Because these can be related to the names of anchors in your document or hypertext links, you can use this for troubleshooting or to remind yourself what the name of an anchor is.

The next group of commands are used for turning the selected text into a hypertext link or anchor:

Anchor Name...
This command prompts you for a name to give to the selected region of text.  The name can then be used as an anchor, the target of a hypertext link.  A default name will be provided based on the content of the selected text, but you can replace it with whatever you like.

Within the editor, text that's been marked as an anchor is displayed on a stippled background, to give you some visual indication where the anchors are in your document.  Anchors are not distinguished visually in jdoc itself.

Local Cross Reference...
This command prompts you for the name of an anchor in the current document.  (You need to precede the name of the anchor with a hash mark, `#'.)  The editor tries to guess a likely anchor name based on the selected text, but you may need to edit it.  The selected text is then turned into a hypertext link to that anchor.

Cross Reference...
This command prompts you for the name of a document to link to, in the same format you would use as an argument to jdoc on the command line.  The editor tries to guess a likely document name based on the selected text, but as with `Local Cross Reference...' you may need to edit it.  In the panel that prompts you for the document name, you can press the Tab key to do filename completion; this is useful if you are editing several documents in the same directory that have links to each other.

You can link to a particular anchor in another document by following the document name with a hash mark (#) and the name of the anchor within that document, as in `jstools.jdoc#Preferences'.  (You can leave the trailing `.jdoc' off a document name and the link will still work, but I suggest you use full names.)

You can also use World Wide Web URL's starting with `http:' or `ftp:'; jdoc will try to use Mosaic to view these.

Incidentally, the `Local Cross Reference...' and `Cross Reference...' commands actually have identical effect; they only differ in the default links they suggest.

Man Page Reference...
This command makes a link to a UNIX manual page.  It prompts you for the name of a manual page, making a guess based on the selected text.  As a convenience, it also changes the selected text to typewriter font.  (In some cases you may want to change this to some other font afterwards.)

Note that the actual text of the manual page is not included in the document, so the manual page will be looked up on the reader's system.  You should be aware that the reader may not have the same manual pages (or any at all) available as you do, and that even if the same manual pages are available, they may describe different versions of software than they do on your system.

The Sections Menu
The `Sections' menu functions identically to the `Sections' menu in jdoc; it lets you quickly jump to a particular section in your document, or to the top or bottom of the document.

Following Links
Ordinarily, clicking on a link within jdoc mode doesn't follow the link.  (It would be hard to select text in a link if clicking did follow the link.)  However, you may want to try following a link in your document while you compose it, for instance to see if you spelled an anchor name correctly.  You can do that by holding down the Control key while you click on the link.

Saving and Loading Files
The file format jdoc files are saved in is internally identical to that that richtext­mode files are saved in, although richtext files don't have hypertext information in them.  (The names of jdoc files should end in `.jdoc', and the names of richtext files should end in `.jrt'.)  The first part of the file contains the actual text, and should be reasonably legible if you look directly at the file contents (with another editor, for example).  This is followed by information about stretches of text with various styles - e.g., where all the sequences of boldface text start and end, and by information about special positions in the file, such as where the insert point is or where the last search started from.  (This last information isn't normally used.)

(This format is implemented by the j:tag:archive_text_widget and j:tag:restore_text_widget procedures in the jtexttags.tcl library, which see for more information.)

Converting File Formats
You can use the editor's `Rich Save As...' command on the `Format' menu to convert your document to other formats.  Currently, only font changes will be converted; underlining and colours are not preserved, and hypertext links are not kept, even if you're converting to a format like HTML that supports them.  This is on my list of things to do.

See Also
	The jdoc Document Viewer
	The `richtext' Mode
} {{{sel {6.61 6.69}} {jdoc:xref:link {4.17 4.22 4.100 4.104 9.6 9.14 9.21 9.38 9.127 9.152 12.287 12.305 15.41 15.45 34.213 34.217 40.115 40.119 44.92 44.98 54.68 54.72 60.77 60.85 62.35 62.60 62.65 62.90 62.109 62.122 65.26 65.41 65.54 65.71 68.1 68.25 69.1 69.20}} {jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 11.0 12.0 53.0 54.0 56.0 57.0 59.0 60.0 64.0 65.0 67.0 68.0}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.8 4.17 4.22 4.100 4.104 6.28 6.32 6.73 6.78 8.0 9.0 9.6 9.14 11.0 12.0 12.206 12.207 12.374 12.378 14.0 15.0 15.41 15.45 15.56 15.60 17.0 19.0 19.93 19.97 21.0 22.0 22.169 22.173 24.0 25.0 26.0 27.0 29.0 30.0 31.0 32.0 32.109 32.115 34.213 34.217 36.0 37.0 37.140 37.141 39.0 40.0 40.115 40.119 40.355 40.358 42.105 42.106 42.164 42.188 42.221 42.226 44.53 44.58 44.64 44.68 44.71 44.75 48.0 49.0 51.122 51.130 53.0 54.0 54.68 54.72 56.0 57.0 57.38 57.42 57.129 57.132 57.335 57.342 59.0 60.0 60.16 60.20 60.77 60.85 60.120 60.128 60.192 60.196 60.218 60.223 60.243 60.251 60.273 60.277 62.35 62.60 62.65 62.90 62.109 62.122 64.0 65.0 67.0 68.0 68.1 68.25 69.1 69.20 70.0}} {richtext:font:italic {12.206 12.207 24.0 25.0 29.0 30.0 32.109 32.115 51.122 51.130 57.129 57.132}} {richtext:font:bold {40.355 40.358 57.335 57.342 62.109 62.122}} {richtext:font:bolditalic {68.1 68.25 69.1 69.20}} {richtext:font:typewriter {4.4 4.8 4.17 4.22 4.100 4.104 6.28 6.32 6.73 6.78 9.6 9.14 12.374 12.378 15.41 15.45 15.56 15.60 19.93 19.97 22.169 22.173 34.213 34.217 37.140 37.141 40.115 40.119 42.105 42.106 42.164 42.188 42.221 42.226 44.53 44.58 44.64 44.68 44.71 44.75 54.68 54.72 57.38 57.42 60.16 60.20 60.77 60.85 60.120 60.128 60.192 60.196 60.218 60.223 60.243 60.251 60.273 60.277 62.35 62.60 62.65 62.90}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 8.0 9.0 11.0 12.0 53.0 54.0 56.0 57.0 59.0 60.0 64.0 65.0 67.0 68.0}} {richtext:font:heading2 {14.0 15.0 17.0 19.0 21.0 22.0 26.0 27.0 31.0 32.0 36.0 37.0 39.0 40.0 48.0 49.0}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:link:jedit.jdoc {4.17 4.22}} {jdoc:link:jedit.jdoc#Mode­Specific_Preferences {9.127 9.152}} {jdoc:link:jedit.jdoc#The_Format_Menu {9.21 9.38 65.54 65.71}} {jdoc:anchorname:The_Format_Menu {8.0 9.0}} {jdoc:anchorname:Saving_and_Loading_Files {59.0 60.0}} {jdoc:link:jtexttags.tcl.jdoc {62.109 62.122}} {jdoc:link:jtexttags.tcl.jdoc#j:tag:restore_text_widget {62.65 62.90}} {jdoc:link:jtexttags.tcl.jdoc#j:tag:archive_text_widget {62.35 62.60}} {jdoc:anchorname:See_Also {67.0 68.0}} {jdoc:link:jdoc.jdoc {4.100 4.104 15.41 15.45 34.213 34.217 40.115 40.119 54.68 54.72 68.1 68.25}} {jdoc:link:jeditmodes/richtext-mode.jdoc {9.6 9.14 60.77 60.85 69.1 69.20}} {jdoc:anchorname:The_jdoc_Menu {11.0 12.0}} {jdoc:link:jstools/shortcuts.jdoc {12.287 12.305}} {jdoc:link:http://www.ncsa.uiuc.edu:80/SDG/Software/Mosaic/ {44.92 44.98}} {jdoc:anchorname:The_Sections_Menu {53.0 54.0}} {jdoc:anchorname:Converting_File_Formats {64.0 65.0}} {jdoc:link:jedit.jdoc#Rich_Save_As {65.26 65.41}} {jdoc:anchorname:Following_Links {56.0 57.0}}} {{matchend 40.196} {abbrevstart 40.222} {richptr 58.0} {abbrevend 40.222} {insert 6.69} {matchstart 40.191} {anchor 1.0} {current 1.0}}}