NO WARRANTY THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---------------------------------------------------------------- LICENSE When the tool reaches an alpha/beta release level of finish, I can consider a suitable license.
2024-08-06: Started 2024-09-04: First published 2024-09-13: Version ------------------------- Change Log ------------------------- - 2024_0914 -- Documents more. - 2024_0913 -- Handles over-long justified-pair input. -- Demonstrates use of block for form fields. -- Refactors some functions for clarity. -- Returns output width value from main function. -- Resizes output textarea to match output width. -- Centers output textarea to width available. -- Improves paragraph wrapping. -- Unifies change log item format. -- Coins the project and format: "Monotext". - 2024_0912 -- Adds multi line comment blocks: (/)comment(//). -- Adds text explaining syntax and using the tool. -- Merges toc block into new (lr) block '(l.r)'. -- Adds changelog to page. -- Sort changelog by version, newer at top. -- Splits demo template to small testable parts. -- Handles separator in pair-block values. -- Untangles frontend code from back. -- Groups all scripts into a namespace. -- Refactors project work as a JavaScript library. -- Marks namespace-global variables for clarity. - 2024_0910 -- Adds spaced divider lines. e.g. '* * *'. - 2024_0909 -- Adds tab sections to front end (CSS only). -- Re-styles front end. -- Adds 'about' (project) to front end. - 2024_0906 . -- Trims trailing spaces from lines. -- Uses (!) for box tag. -- Uses any input title variable as HTML title. -- Uses any input title variable as save name. - 2024_0905 -- Uploads early alpha. - 2024_0904 -- Styles frontend, minimally. -- Fixes a regex to make block settings not greedy. -- Tweaks match logic for front matter block. -- Handles front matter values that include ': '. -- Adds download buttons: input, output, both.zip. -- Pads right of header only if character not ' '. -- Preserves whitespace-only values in variables. -- Calculates and shows byte/KB weight of output. -- Shows how to make a table cell empty. -- Adds T.O.C block: key left, dots, value right. -- Adds template system: logic, loader, examples. -- Tells variable swapper to not expect ')' in key. -- Punctuates and presents frontend example text. -- Adds 'no script' notice. -- Adds copyright notices and comments etc. -- Links to author page. -- Adds light and dark mode to frontend. -- Sets max line width (90ch), documents range. - 2024_0903 -- Parses consecutive divider-lines correctly. -- Splits long headers over multiple lines. -- Narrows multi-line headers to look centered. -- Tweaks 'surround header' instruction. now '=h'. -- Makes header uppercase if 'H '. leaves if 'h '. -- Adds header underlining via 'h=' 'h-'. -- Makes border styles easier to change on backend. -- Enables blank lines in 3 column block columns. -- Lets front matter instruct tool e.g. line width. -- Lets pair tag set key and value alignment & case. -- Prevents rules acting on already converted data. --- Stores converted block. returns a placeholder. --- Swaps placeholder for stored block at end. -- Tweaks pair-block multi-line and align logic. -- Starts a changelog, logs work in approx. order. -- Adds a template document to demo a use case. -- Keeps converted blocks accessible via console. -- Clears any data from previous run per run. -- Hides gap in table top border if table unnamed. - 2024_0902 -- Adds pairs block: to present 'key: value' data. -- Add variables: use front matter values in file. -- Adds easy column align to 3 column block (3=rcl). -- Adds align right block: (r)lines(/r). -- Transposes tables with '(grid x)' side by side. - 2024_0901 -- Adds ^uppercase^ & $s p a c e d$ (temp tokens). -- Adds basic interface with live update. -- Splits mono-file project to: HTML, JS, CSS. -- Adds comment tag '// ' to omit text from output. -- Adds front matter block for document meta data. -- Adds list block. -- Breaks long list item over indented lines. -- Splits long text line into multiple lines. -- Adds box block: hard wraps long lines and title. -- Adds 3-column-line feature 'left middle right'. -- Hard wraps long data in 3-column-line column. -- Gives 3-column-line closing tag:(3)c1 c2 c3(/3). -- Swaps 3-column-delimiter: (3)col1()col2()col3(/3). -- Lets each 3-column-block column hold new lines. -- Adds table block for data free of line-breaks.
For more about the tool and using it, see the Tool section. ================================================================ MONOTEXT (Initial specification) Each Monotext document follows these rules: - A fixed maximum line width. - Hard wrapped lines. (Line breaks create all new lines.) - One monospace font. Restricted to: -- One font-size. -- One font-weight (regular). -- One font style (upright). -- One line height. - One background hex. - One content hex. -- Ideally, at least 50% contrast between the two. --- I.E. Greater contrast than black on middle grey (#808080). - Space characters create any horizontal whitespace. - Line breaks create any vertical whitespace. - Any visible characters that typeset copy use an ASCII subset: -- The subset of ASCII 128 common to typewriters and computers. These restrictions typeset text to display the same everywhere. The tool typesets text to meet these conditions. ================================================================ STYLE - Any divider line delimits sections so precedes a near header. ================================================================ ABOUT THE PROJECT I wanted a tool to easily typeset plain text in a specific style: following the conventions of typesetting on a monospace typewriter. Having plans only for the output format, this early working example consists of many placeholder solutions. I made each part as needed to get from one step to the next. Byproducts of reaching the initial goal include: A sketch for a simple markup syntax A basis for a vanilla JavaScript library An interface to test and use the tool easily.
INPUT
Plain text format syntax
OUTPUT
Monospace typesetting
Save txt: