⬆️ ⬇️

Preparation of articles for Habr: Markdown extension + syntax highlighting + loading images

Description

I present to your attention the extension of the "human" Markdown markup language for use on Habré. The main goals are:
Using
  1. Download and unpack the archive into a separate folder
  2. Writing an article in the article.txt file
  3. We copy in the folder the necessary images
  4. We type make copy , we get the HTML text of the article in the article.html file and in the clipboard
  5. We post on habr
Kit contents
Requirements
Make targets
Download
habraml.zip

Standard Markdown Markup

Official syntax documentation
Headlines
  First level heading
 ========================

 # Too first level heading #

 # Or so

 Second level heading
 ------------------------

 ## Too second

 ### Third
Text selection
  plain text
 * oblique, _ also oblique_,
 ** fat **, __ fat too, __,
 `code`
plain text, oblique , also oblique , bold , also bold ,
Quote
  > Familiar-these are people, just in case they call you a fool.
 > Good friends can already tell you a bad joke.
 > Friends are those who really know a few real nasty things about you.
 > Don Aminado
Familiar - these are people, just in case they call you a fool. Good friends can already tell you a bad joke. Friends are those who really know a few real nasty things about you. Don Aminado
Or so:
  > The idea, perhaps, has the greater independent value,
 the less one believes in her from whom she emanates, for she then does not
 reflects his desires, needs and prejudices ...
 Oscar wilde
The idea, perhaps, has that greater independent value, the less the one from whom it comes from believes in it, for it then does not reflect its desires, needs and prejudices ... Oscar Wilde
Links
  [link to habrahabr] (http://habrahabr.ru)
link to habrahabr
List
Unnumbered (you can use "-", "+" and "*"):
  - item1
 - item2
Numbered (you can use one number for all elements):
  1. First
 2. Second
  1. First
  2. Second
Horizontal bar
  --------------------------

Picture
  ! [Habr logo] (https://habrastorage.org/getpro/habr/post_images/142/895/3aa/1428953aa0d7b50586df81c2bbf78b53.gif)
Habr's logo

Extended formatting

Headlines
Header levels are shifted by 3, as required by Habr. Those. headlines start at level four.
Habrakat
  -x ----------------------------

 -x ---- Text instead of "Read more"
Habrayuser link
  @kriomant
kriomant
Strikethrough
  ~~ strikeout text ~~
strikethrough text
Local Images
If the address of the image does not begin with "http: //", then the image is considered local. In this case, two lines are read from the file “address_image.address”: the first is the address of the thumbnail, the second is the address of the full-size image viewing page. A small copy of the image is inserted into the page code with reference to the original. The files “* .address” are automatically generated by the build script when loading images.
Syntax highlighting
  @ python @
 print ('string')
 for item in (2, 3, 4):
     print (item)
turns into:
print ( 'string' )

for item in ( 2 , 3 , 4 ):

print (item)

Display problems

The habr parser is a very strange and unpredictable thing. For some reason, he cuts out the “p” tags, does not display “hr”, incorrect parsing of the link, and even makes exclamation marks himself . The most necessary hacks, without which nothing is shown at all, I applied. I consider the code to be corrected further under various glitches wrong: the parser may be corrected in a year or two, but no one will redo the text of the article anymore.


')

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



All Articles