πŸ“œ ⬆️ ⬇️

New lite text markup language based on pair quotes (pq)

I can not explain where the idea of ​​such a markup language came from, but what happened in the end is quite ... entertaining.

I do not count too much on the wide practical application of this thing , but some of the ideas used in this markup language may well provide food for thought and somehow contribute to the development of other existing or new languages.

So, I will pass to the description of the language itself. [ If someone suddenly doesn’t understand what it’s all about, then lightweight markup languages include Markdown, BBCode, wiki markup, etc. ]

This markup is based on single pair quotes - the characters ' and ' (the question of choosing these characters is explained below in PS), so for now I have chosen the name variant: pc markup or pqmarkup (paired quotes markup).
')

How do these quotes typed on the keyboard?


In the Windows OS, you can use the AutoHotkey program to assign global hot keys to enter any special characters. To assign for example Alt + 9 and Alt + 0 to enter single double quotes it is enough to add these two lines to the settings script file:
 Alt & 9:: SendInput {'} Alt & 0:: SendInput {'} 

Also in Windows, you can use the Alt +0145 key combination (on the numeric keypad) for the opening quote ' and Alt + 0146 for the closing ' (though this does not work in all programs , and also requires a certain NumLock state) without additional settings.

Visually on the numeric keypad, these numbers are very well located:
 β”Œβ”€β”€β”€β”¬β”€β”€β”€β” β”‚ 4 β”‚ 5 β”‚ β”œβ”€β”€β”€β”Όβ”€β”€β”€β”˜ β”‚ 1 β”‚ β”œβ”€β”€β”€β”΄β”€β”€β”€β” β”‚ 0 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”˜ 

It looks like the opening square bracket [ .
Very easy to remember.


Syntax pc markup


Text decoration

*''fatty
_''underlined
-''crossed out
~''italics
Note:
This is not how it works: ~*' ' (it will be just ~ bold ), write like this: ~'*' bold italics '' or like this: *'~' bold italics '' ( as planned ).
Please note that the use of separate characters for opening and closing quotes provides the possibility of unlimited nesting of formatting elements.

Links and tooltips


Link [http: // address]
Link [http: // address 'quick info text']
Text ['tooltip text']
More (more examples)
Pc markingHTMLHow does it look
[http: // address]<a href="http://address"> http: // address </a>http: // address
link [http: // address]<a href="http://address"> link </a>link
link [https: // address]<a href="https://address"> link </a>link
'verbose link' [http: // address]<a href="http://address"> verbose link </a>verbose link
link [https: // address 'quick info text']<a href="https://address" title="texttext"> link </a>link
text ['quick info text']<abbr title = "tooltip text"> text </ abbr>text


Headings, pictures, color and tables

H (Russian)H (English)Title Title \ Header
R (Russian)P (English)Figure \ Picture [why not I (image)]
C (Russian)C (English)hw (Light) \ Color
T (Russian)T (English)Table \ Table
Examples:
Title - Title Title
Picture - R'http: // picture_address'
Text in red - (# 0000) 'text'
More (more examples)
Pc markingHTMLHow does it look
Headers \ Headers
H'Header '<h3> Title </ h3>

Headline

H (0) 'Title'
H (1) 'Title'<h2> Title </ h2>

Headline

H (+1) 'Title'
H (-1) 'Title'<h4> Title </ h4>

Headline

Pictures / Pictures \ Pictures
P'https: //.../blue_circle.png '<img src = "https: //.../blue_circle.png" />
P'https: //.../blue_circle.png '[http: // address]<a href="http://address"> <img src = "https: //.../blue_circle.png" /> </a>
P'https: //.../blue_circle.png '[' tooltip text ']<img src = "https: //.../blue_circle.png" title = "tooltip text" />
P'https: //.../blue_circle.png '[http: // address' quick info text']<a href="http://address" title="texttext"" <img src = "https: //.../blue_circle.png" /> </a>
Text color
The color is set in the #KPCZSS format (Red, Green, Blue) using hexadecimal digits (Cyrillic can be used: absdef / ABSDEF is an analogue of abcdef / ABCDEF) or in KZS format using numbers from 0 to 8 .
With (# ff0000) 'red text'<span style = "color: # ff0000"> red text </ span>red text
<font color = "# ff0000"> red text </ font>
C (800) 'red text too'<span style = "color: # FF0000"> also red text </ span>also red text
<font color = "# FF0000"> is also red text </ font>
C (000) 'black text'<span style = "color: # 000000"> black text </ span>black text
<font color = "# 000000"> black text </ font>
With (4) 'gray text'<span style = "color: # 808080"> gray text </ span>gray text
<font color = "# 808080"> gray text </ font>
C (-880) 'text on a yellow background'<span style = "background-color: # FFFF00"> text on a yellow background </ span>
Tables
'
''A' 'B' 'C''
''1' '2' '3''
'
<table>
<tr> <th> A </ th> <th> B </ th> <th> C </ th> </ tr>
<tr> <td> 1 </ td> <td> 2 </ td> <td> 3 </ td> </ tr>
</ table>
ABC
one23
Merging table cells
To merge table cells, each missing cell must be replaced with a symbol - or a symbol | so that following the symbol - left and the symbol | up could go to the corresponding meaningful cell.
''
'A' 'B'
''
'C' -
''
<table>
<tr> <td> A </ td> <td> B </ td> </ tr>
<tr> <td colspan = "2"> C </ td> </ tr>
</ table>
AB
C
T''
' ' ' ' '1' ''
' ' ' ' | ''
'2' - | ''
<table>
<tr> <td> </ td> <td> </ td> <td rowspan = "3"> 1 </ td> </ tr>
<tr> <td> </ td> <td> </ td> </ tr>
<tr> <td colspan = "2"> 2 </ td> </ tr>
</ table>
one
2
T''
' ' ' ' '1' ''
' ' ' ' | ''
'2' - - ''
<table>
<tr> <td> </ td> <td> </ td> <td rowspan = "2"> 1 </ td> </ tr>
<tr> <td> </ td> <td> </ td> </ tr>
<tr> <td colspan = "3"> 2 </ td> </ tr>
</ table>
one
2
For large cell combinations (2x2 or more): to the right of the meaningful cell, the symbols go - , the symbols go down | , and the remaining missing cells can be filled with either a symbol - or | but it is recommended to always use - .
T''
'1' - - '2' ''
| - - '3' ''
| - - '4' ''
'5' '6' '7' ''
<table>
<tr> <td colspan = "3" rowspan = "3"> 1 </ td> <td> 2 </ td> </ tr>
<tr> <td> 3 </ td> </ tr>
<tr> <td> 4 </ td> </ tr>
<tr> <td> 5 </ td> <td> 6 </ td> <td> 7 </ td> </ tr>
</ table>
one2
3
four
five67


Comments


[[[comment / water container (: ]]]


A complete description of the formatting syntax.



(If anyone is interested, here’s a little tag selection history [for tables])
Initially, I planned an alternative option for specifying tags. Here is this:
[[H]Header/[-H]]
or
[[H]Header/[-]]
or
[[H]Header/]

Accordingly, the tables were set by the tag [[T]...]
The column delimiter was this - []
The line delimiter was [[]] - [[]]

Example table:
  [[T]
 A [] B [] C
 [[]]
 1 [] 2 [] 3
 [-T]] 
or so:
  [[T]
 [[]] A [] B [] C
 [[]] 1 [] 2 [] 3
 [-T]] 
(The [-] closing tag can be omitted.)

But then I remembered that several choices for the same formatting are something that I don’t like in Markdown (for example: ____ or **** ), and I decided to leave two formatting options in the PC markup ( ~'...' and [[~]...] ) will be wrong. So, it makes sense to leave only one form of the record - with quotation marks '' , since it is less conflicting and is the first / main idea that initiated this text markup {and the fact that typing quotation marks ' and ' unusual - I think not so scary, because [ from my point of view ] it is more important to read the markup and its cognitive characteristics (easy to understand / remember the rules of markup, easy to read / perceive the marked text), as well as reducing the likelihood of conflicts (when simple text or formula [ wrong / ] unamer It is interpreted as markup) and avoiding the need to screen something (otherwise you can often skip / not notice such errors - when the marked text was converted a little to what was intended)}.

Having made my choice in favor of quotes, at first I wanted to make such a line delimiter - '' (by analogy with [] ), but quickly changed my mind (because then there is a problem with empty cells in the table itself) and came to the current form of writing:
'
''A' 'B' 'C''
''1' '2' '3''
'

or so:
''
'A' 'B' 'C'
''
'1' '2' '3'
''

(Of course, this form of recording is not the most pleasant for typing and I thought a lot about whether it is possible to simplify it somehow (or at least give the possibility of an alternative, simpler form for writing tables, like in GitHub Flavored Markdown or in Habrahabr Flavored Markdown [ By the way, most implementations of Markdown do not support tables without headers ] ), but decided to stop at the current form of the record, since it is so light enough (compared to HTML <table>) and at the same time has an undeniable advantage [ over a simpler form record] - the ability to include yache ku table anything (including any other elements of the mark, and even nested tables), as well as the current form of writing makes it possible to use the spaces at the beginning and end of a line of any table (possibility controversial, but it can be useful to export database tables) of the cell.)

(If anyone is interested, here is the story / 'how I came to the' current record form for combining table cells)
... no, I decided to hide it in a comment and not include it in the article, and if anyone is really interested, then see the source of the article.

The source of this article is written on the PC markup. Converted to the Habr HTML format through a Python implementation (with the command-line flag --habr-html ).

PS
The reasons (by the way, quite subjective), why I chose the characters '' (and not `Β΄ or, say," "or β€œβ€ ):

  1. They look nice enough (in the appropriate font [ for example, Courier New ] ). In my opinion, better than "" or β€Ή.
  2. They follow one after another in any encoding (as opposed to `Β΄ orβ€œ ”orβ€Ή β€Ί) [ as well as β€œβ€ ] .
  3. Why not β€œβ€ - in Russian texts the double symbol β€œ is β€ž ( Screen typography. Quotes ).
  4. And I also like the codes [/ years] of these characters ...
    201? and 201ΒΏ

One significant minus of the quotation marks ' and ' is that the single quotation mark character ' according to the current Unicode standard is the preferred character as an apostrophe character, and in many documents and web pages in English, the ' character is actually used as an apostrophe (for example : Don't ), including - in the generated documentation for Python , however in HTML-code it uses the HTML entity recently used there recently &#8217; , and in the source rst-files of the documentation the usual apostrophe is used - so both html (when using &#8217; ) and rst-files can be enclosed in ' such ' quotes without problems [ and, by the way, the most well-known [ me ] typographers (with rare exceptions) insert HTML entity &rsquo; [ or &#146; or &#39; or &#8217; ] , and not directly the closing quote character itself, and if you look at the largest English-language news resources, you can see that many of them simply use the apostrophe character (contrary to the recommendations of the Unicode Consortium) as an apostrophe) , but if there is such a need , the PC markup allows you to insert an unmatched opening ' and closing ' quotation mark: so `'` or so ''' (see Advanced Formatting Features. Raw \ Raw HTML ).

Another minus [ quotes characters ' and ' ] is the ambiguity of displaying the characters ' and ' in many popular fonts. In particular, in Consolas, used in GitHub and Bitbucket. In general, the characters of pair quotes in different fonts look different (including in monospaced programming fonts):

[ In my opinion, this simply shows that, in general, there is no clear / unambiguous idea of ​​how these characters should look. ]

(By the way, on HabrΓ© the characters of single double quotes were displayed quite acceptable (at least in Windows) due to the use of Verdana for the main text and Courier New for the code, but a few months ago the font for the main text of the articles was changed to Arial, because of I had to tweak the article a little - replace 'and' with ' and ' (in pq: `'` and `'` ).)

Source: https://habr.com/ru/post/348218/


All Articles