3 ms·
Although I use HTML every day, most personal documentation I save is not in HTML format. It is in ASCII. I have some text files that can grow quite large and
by 1vuio0pswjnm7 3y ago
Although I use HTML every day, most personal documentation I save is not in HTML format. It is in ASCII.
I have some text files that can grow quite large and one trick I use is to keep a less history file to help me navigate. For example, I can save searches and marks in a history file. The format is simple.
.less-history-file
.search
"term1
"term2
.mark
m a 1 46248 1.fifo
m b 1 11509 1.fifo
Then I use a small shell script to read the text file. Something like
#!/bin/sh
(zstd -dc /path/file.txt.zst > 1.fifo&)
LESSHISTSIZE=999999999999999999999999 \
LESSHISTFILE=/path/.lesshst.file.txt.zst \
exec less -G --save-marks --no-histdups 1.fifo
Another aproach might be to use an editor with macros like ex/vi as the pager.
Sometimes I see people converting text files into HTML, e.g., RFCs or manpages, but in these documents there are often no "hyperlinks" so the HTML at best only adds enhanced appearance and possibly the ability to jump around within the document. At a cost of making them significantly larger.
Instead of using markup and storing navigation information in the file, and using an HTML reader, this stores the information in a small, separate, associated text file.
- Someone 3y agoHow do you guarantee that file is ascii? I would think it rapidly would become non-ascii for most users, even for English speakers. You can’t write café in ascii, for example, use curly quotes, or write a pound, euro, or yen sign
- evandale 3y agoI'm not the parent, but I personally can't think of a single instance where I would write "café" instead of "cafe". I can't imagine needing to use a pound, euro, or yen sign either. I'd probably just write pound, euro, or yen if I needed to talk about those currencies. It's a pain to use any of those characters on every device I use so I don't see how any of them could get in the file if I were to adopt this.
- paulddraper 3y agoMost people write only the characters on their QUERTY keyboards. cafe, resume, fiance, etc
- ElectricalUnion 3y agoBut are you gonna generate 100% of such files using only your typing? What about Input Method Editors or copy-pasting?
- 1vuio0pswjnm7 3y ago"How do you guarantee that the file is ascii." I use an HTML reader set to 7-bit ASCII. If necessary I replace or eliminate non-ASCII characters I do not want. I often use flex or tr for this task. In the situation described in the comment, I'm not sharing these files with anyone else. I'm reading these files myself. As such, other users' preferences are irrelevant. The submission is about ASCII for "network exchange". But the comment replied to here is not necessarily about ASCII for network exchange. It's about a method used by yours truly for reading large ASCII files.
- 1vuio0pswjnm7 3y agos/characters/bytes/
- hn_throwaway_99 3y agoSome clarification: ASCII is not a format, it's an encoding. You are referring to "plain text" vs. HTML. For the rest of what you've written, this feels like a million times more complicated than using markdown.
- 1vuio0pswjnm7 3y ago"You are referring to "plain text" vs. HTML." The term "ASCII format" in the submission title comes from the IETF Internet Standard, not me. Contact the author Vint Cerf or the IETF with objections. Not much I can do to change an Internet Standard. In this comment, I never used the term "ASCII format". I used the term "HTML format". What is "markdown". Word play on the term "markup".
- hn_throwaway_99 3y agoYou are misunderstanding: 1. ASCII simply defines a byte encoding to represent characters. E.g. UTF-8 is another character encoding. HTML files are often written in ASCII. 2. Markdown is a very common standard for representing minimal formatting in a plain text file: https://en.m.wikipedia.org/wiki/Markdown https://en.m.wikipedia.org/wiki/Markdown
- 1vuio0pswjnm7 3y agoThanks, I understand now. For personal documentation, I prefer files of MIME type "text/plain" rather than "text/html". For text encoding, I prefer 7-bit ASCII. I do most reading in textmode. I generally dislike use of UTF-8. I dislike use of ANSI escape sequences to enhance text. These are my preferences, not necessarily anyone else's. Markdown has extra garbage in the file. No different than tags in HTML. RFC 7763 describes markdown as "lightweight markup". In the comment I am describing keeping extra garbage in a separate file. Although I have thought about storing the contents of the less history file at the top of the document, sort of like a table of contents, then extract it to a less history file when I want to read the document with less.