Skip to content
Keyboard And Me

The Layout of Docusaurus

Docusaurus is Meta’s open source document authoring platform. It generates clean and modern document sites written in markdown.

The Major Takeaway

It uses semantic HTML tags for each major part of the screen.

Docusaurus Layout

This is so clean we can copy over to any website we want to create.

It is React

In fact it is a React Single Page App with local routing. AND it is powerful. So powerful.

The only gripe I have is that like any React App, major version update can be a bit of PITA. There is already two major version updates, and the migration pages looks a bit daunting isn’t it. With for example Python’s Sphinx, you could migrate 10 year’s version change in 10 minutes. (I did it and I know it)

But Docusaurus is pretty. Who can resist that?

Styling

Under the hood Docusaurus uses a styling framework called Infima. From the look of it, it is a Tailwind like framework, but with abstractions to facilitate component and layout creation. A typical 20 class name Tailwind style instruction could be created with Infima in two or three class names. It still isn’t production ready outside of Docusaurus, though.

The Layout of Hacker News

Hacker News is probably one of the few top sites with a table layout. A call from the distant past.

The Front Page

The front page is just a table inside <center> tag. The “More” button at the bottom leads to another page, which is loaded with a new HTTP request.

The main content is again a <table> inside <tr>, with each of its row as a news entry.

Hacker News Layout

Page style is controlled by a CSS file which is only 178 lines. The mobile style is controlled with @media queries. All very simple.

The @media only screen is used in various places of the CSS file. Its use is to prevent older browsers (which don’t support media queries) from loading the styles. See MDN.

The Vote Button

Interestingly, there is style definition that rotates the upvote arrow:

.rotate180 {
  ... /* 4 other lines for old browsers */
  transform:         rotate(180deg);

But I can’t seem to find it in the UI. Turned out that only people with 100+ karma can downvote. I with my puny 11 karma can’t do nothing.

BTW, the SVG file is already quite small, fewer bytes that the CSSlines. It might just load faster if they use a different SVG for downvote, but I don’t know.

The Stories

Each comment is a table. The tree indentation is implemented with a placeholder gif image inside a <td>. The image width is fixated to the indentation level, first level 40px, second 80px, etc.

The expanding/collapsing is controlled by a callback function. The total lines of JavaScript is just 151, and it’s not compressed in any way. Remarkable.

Western grammatical influence on vernacular Chinese in the 20th century

Note: This is an answer to a StackExchange question: https://chinese.stackexchange.com/questions/20763/western-grammatical-influence-on-vernacular-chinese-in-the-20th-century

Regarding to how early writers are influenced by western languages. The renowned poet and translator 余光中 has written quite a lot about it. Below are some examples he mentioned in his articles.

Deliberate plurals. Traditionally plurals are only used when absolutely necessary. In the following sentence the reader doesn’t actually care whether it’s one fly, a group of flies, or fly as a species. Therefore, it’s better to leave it out.

战士战死了的时候,苍蝇们所首先发现的是他的缺点和伤痕…… ——鲁迅《战士和苍蝇》

Deliberate plurals, and apparent western pronoun-phrase — “your total extinction”. A colloquial way to say it is 我诅咒你们全灭.

大小一切的苍蝇们……我诅咒你的全灭。——周作人《苍蝇》

Yes we know you’ve been to Cambridge. We can totally tell. “不曾知道过” is an imitation of the English past participate “haven’t known”. “更大的愉快” is an imitation of the English comparative “greater happiness”. In whole it looks like an awkward English sentence being translated to awkward Chinese. 我不知道什么比这更愉快 would be much better.

我不曾知道过更大的愉快。——徐志摩《我所知道的康桥》

Typical stacked modifiers. Very unsinological I’d say. It’s not even good English. With English you can use clauses to right-branch a sentence, with modifiers trailing behind, theoretically ad infinitum. With Chinese, all modifiers are supposed to put at the left side. If the modifiers gets overabundant, the sentence would be very hard to digest. Usually this kind of sentences should be completely restructured.

我这本书只预备给一些“本身已离开了学校,或始终就无从接近学校,还认识 些中国文字,置身于文学理论、文学批评以及说谎造谣消息所达不到的那种职务上, 在那个社会里生活,而且极关心全个民族在空间与时间下所有的好处与坏处”的人 去看。——沈从文《边城》

Another example of stacked modifiers.

但我是更感动于那些无望的度着寂寂的光影,沉默的,在憔悴的朱唇边浮着微笑,属于过去时代的少女的。——何其芳《哀歌》

余光中 went on to say that some of the writers, including 鲁迅 and 胡适, are already excellent 文言文 writers, but when they write 白话文, they tend to lose themselves and incorporate western language features into their articles. 鲁迅 even did this deliberately because he thought the contemporary Chinese wasn’t expressive enough and it had to be improved this way.

At first this was only a literary vernacular, but they do pierce into the spoken language. Modern mandarin is already a conglomerate because of the influence of early 白话文 and their authors. In late 1970s 余光中 even proposed to eradicate 恶性西化 in Chinese.

El Nombre del Juego

Hoy hablo del nombre del juego tablero chino más antiguo y más avanzado a la vez, el juego conocido como “go” en varios idiomas del resto del mundo, incluso el español.

La palabra “go” proviene del japonés, pero el juego es de China. El juego se llama “weiqi” en chino, pero dudo que muchas personas sepan este nombre.

Entonces por qué el mundo toma el nombre japonés y no el chino?

Primero, entre los tres países donde la gente juega el juego a nivel avanzado (China, Corea y Japón), El Japón era el primero país que había abierto sus bordes y establecido una significante conexión cultural al occidente. Segundo, Japón había mantenido la ventaja técnica y cultural de este juego hasta el fin del siglo XX. Y por último, los jugadores japoneses tomaban literalmente sus vidas popularizando el juego: Kaoru Iwamoto (岩本 薫) ayudó a fundar numerosas asociaciones de go en las Américas durante la jubilación. Hans Pietsch, jugador de Alemán y estudiante de Kobayashi Satoru (小林 觉, jugador profesional japonés), falleció de asalto en Guatemala cuando estaba promocionando el juego.

Por otra parte, Corea y China estaban en turbulencia social, político y económico en la major parte del siglo XIX y XX. Solo han establecido su competencia en este juego en el fin del siglo XX.

Francamente no me gusta el nombre “go”. Es muy confuso: En ingles “go” es un verbo comunísimo. En español no hay otro sustantivo de tal forma.

Pero qué tal el nombre chino? Es peor: Weiqi. Nadie excepto los chinos sabe como pronunciarlo.

El nombre coreano, “baduk”, es el mas pronunciable para todos (salvo los chinos, que no saben qué hacer con el consonante final). Y el subreddit de este juego ha tomado este nombre r/baduk. También hay r/weiqi pero no tiene más que 4 usuarios activos.

Creo que de aquí surgió una guerra cultural secreta entre Corea y China, y China está perdiendo. Los coreanos usan “baduk” en los videos de YouTube aunque están dando lecturas y comentarios en inglés. Y los chinos - Disculpen. No he encontrado ningún cuenta china de weiqi de habla inglesa. Y según el Google Trends, el mundo preferió weiqi antes del año 2014, y “baduk” después.

Journal 2022-07-05

Today is the first day I went back office. The office computer is behaving weird. The LCD won’t light up during startup. I may need to get it fixed another day.

And of course, I went for the wrong direction while taking the metro home.