글쓰기를 위한 Pidgin HTML 마크업, 또는 HTML이 얼마나 지속될 수 있습니까?

hackernews | | 🔬 연구
#html #review #글쓰기 #리뷰 #마크업
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

저자는 HTML 작성의 번거로움을 해소하기 위해 ed(1) 스크립트와 정규 표현식을 활용하는 자신만의 'Pidgin HTML' 방식을 소개합니다. 이 방법은 약식 태그와 닫는 태그 생략 등의 편의 기능을 제공하지만, 빌드 과정을 거치면 표준 HTML 사양을 준수하여 모든 주요 브라우저와 파서에서 정상적으로 작동합니다. 또한, IE 주석과 서버 사이드 인클루드(SSI)를 창의적으로 활용하여 조건부 처리 및 파일 인클루드 기능을 구현함으로써 Markdown 같은 경량 마크업 언어의 강력한 대안으로 제시됩니다.

본문

Pidgin Markup For Writing, or How Much Can HTML Sustain? By Artyom BologovI am an HTML extremist. There’s this argument I often hear: “But HTML is cumbersome to write!” Wrong, as many other myths about HTML. In this post, I’m detailing how I write my dialect of HTML and why it’s easy. This Pidgin HTML dialect is intimately tied to my website setup: I’m using ed(1) as my Static Site Generator. Which means the setup is: - I write my Pidgin HTML in .htm files. It’s a standard HTML extension, but it’s useful to differentiate from the resulting.html for build purposes. - I preprocess SSI-like comments and include files. - I convert overly smart and (slightly) weird tags into valid HTML. - And then I send the result to Another Person’s Computer™ for you to see on aartaka.me. This setup is no rocket science, doing sloppy tags, regex substitutions, and shell scripts. And yet it results in a dialect of HTML that’s easy/er to write. And almost standard/conventional. Here’s a set of engines I’m testing my markup with: - Dillo - w3m - Firefox/LibreWolf - (Ungoogled) Chromium - WebKitGTK browser engine - Plump, an HTML parser for Lisp. So yeah, it does work everywhere, even as the raw source form. You can see the initial Pidgin HTML for this post rendered at pidgin.htm, and download it to preview the text behind it. On to the quirks then! Smart tags # HTML links are slightly painful to type out. So I made my own syntax, knowing that my build regex will expand it for me: There’s a bunch of other tags, like word for simpler code tags. And shorter . Not much, but more than enough for comfortable writing. Now to the more grand things. Implied End Tags # I think this is the heritage of sloppy HTML 1/2/3 programming. You know, with shortcuts following authors’ practice. The primordial chaos reigning in the early Internet. Long story short, you don’t have to close . Its end tag is implied and closed whenever e.g. the next opening aragraph tag is encountered. Spec: li, dt, dd, td, and some others also work this way. This is valid processable HTML: this ul... You may’ve noticed the followed by text. This is another of my shortcuts. It looks alright (indented) when opened from source .htm file. It’s easy to type. And it’s a simple substitution away from a valid list. Having these, I can generate sensible HTML with ed(1) scripts. While having the convenience of shortcuts in standard HTML. All according to the spec! Closing Tag Space # Here’s a fun one: HTML spec forbids putting anything into closing tags (anything after when previewed in .htm source. But once I process it with my build scripts, it expands to a proper . Without the need to write all the formalities out myself. Arbitrary Attributes # A thing partially related to closing tag contents: HTML allows anything as attributes. This previous sentence might work well as an attribute set: I’m using that for e.g. tables and : And I’m using as a shortcut for headings with IDs ( ). Pidgin HTML is Still HTML # Let this post be a praise to - shortcuts of HTML, - its simple user-facing nature, - and the universality and power of Web Platform. Pidgin HTML is made possible by sloppiness of the standard/quirks HTML. It’s still valid HTML, but one that is much easier to write. Good for authoring as a hypertext alternative to Markdown. And other Lightweight Markup Languages. Don’t be afraid of HTML. Write Pidgin HTML. Magic IE Comments and Server Side Includes # In case you ever opened the inspector on some major site, you might’ve seen these [if IE] comments. Basically Internet Explorer specific comments that only IE evaluates. Other browsers perceive them as mere comments.These are useless in the modern post-IE world. That’s why I’m exploiting them to generate format-specific content. Say, making a link footer when generating Gemtext from this Pidgin HTML: (I've since removed Gemtext backend from this site, unfortunately. Gemtext is too primitive.) Another point of reference might be Server Side Includes. Initially Apache-specific format of commands embedded into HTML (or, rather .shtml) pages. Allowing file inclusion, conditional expansion, shell/CGI command execution etc. A much needed logic-ful HTML extension. So I’m using SSI as an inspiration, making my own #include and#exec directives.This is recognized as a mere starting tag. Or, in case of the SSI version, as a comment. Harmless.

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →