工具与资源docs.racket-lang.org
Pollen:书就是程序
Pollen: the book is a program
2017 — 2024,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Pollen 是基于 Racket 语言的图书/网页创作系统,核心理念是“书即程序”:作者用可编程的标记语言写作,把排版、结构和内容融为一体,直接用代码生成最终出版物。文档展示了如何自定义标记命令、处理文本结构,作者本人用它出版了多本排版精美的书。
为什么经久不衰:它代表了一种把出版流程彻底编程化的思路,多年来反复被讨论,对想精细控制书籍或网站排版的写作者和程序员仍有启发。
HN 评论精选
Pollen 体现了与 React 类似的趋势:把原本分离的代码与内容合并为同一关注点
有趣的是,出版领域正在普遍偏离“代码、模板、样式、文本相分离”的模式,转而把它们合并在一起。React 这样做了,Pollen 似乎走得更远,把文本也放进代码里——或者说把代码放进文本里。这种转变令人意外:大家仍讲“关注点分离”,只是对什么算同一个“关注点”的理解翻转了。我不确定写作是否该这么做,但用 Pollen 出版的书确实漂亮且易于导航。
SwellJoe查看英文原文
It's interesting to see a somewhat widespread shift away from the separation of code, templates, styles, and text model of publishing things (mostly websites, but most publishing can be boiled down to that if you squint), where code/templates/style get merged into one. React does this. Pollen seemingly takes it even further and sticks the text in the code, too. Or, rather sticks the code in the text, I guess. It's a surprising shift. "Separation of concerns" is still a thing everybody wants to do, it's just flipping the idea of what should be the same "concern", where React considers every piece of a component to be one concern...and, it seems to work. I'm not sure I'm on board with this for writing, but the results certainly do look very nice; the books the author has published with Pollen all look gorgeoues and are very navigable. I've been tinkering with Hugo for converting my projects docs to something that isn't in a wiki or a CMS (because I find I dread working with either a wiki or a CMS for large documents). I think it's probably "enough" for all of my needs, so I doubt I'll take the time to learn a bigger system like Pollen...but, it's hard to argue with the quality of the results.
真实用户案例:教师用定制标记语言高效编写并自动处理课程作业
我是计算机课老师,用 Pollen 写作业题。它能让我以思维的速度输入作业,使用专为我的题型定制的标记语言,然后轻松完成语法高亮、弯引号转换、题目编号、打印排版等后处理。还能向学了几个月 Racket 的学生展示:连他们的作业都可以用新学的技能自动化生成。
alew1查看英文原文
I'm a CS teacher and use Pollen to write my assignments (sample: https://drive.google.com/file/d/0B9DAZWpkQIDuUlA4SU5lcHItRDg/view?usp=sharing). It allows me to type assignments as fast as I can think them, in a specialized mark-up language for exactly the type of assignments I give. I can then apply various post-processing operations (like doing syntax highlighting, converting straight quotation marks to curly but not when inside sample code, numbering of problems, inserting special CSS to make the assignments print with nice margins / without breaking up headings and paragraphs that belong with them, etc.) all with very little pain. It's also neat to show students, after they've spent months learning Racket, that all sorts of useful things -- including the writing of their assignments! -- can be automated with their new skills.
实际使用者证实:可编程标记和 Lisp 的数据模型让扩展排版功能非常顺手
我正在用 Pollen 制作我的在线书,体验很好。虽然博客用 Markdown 写,但能在标记语言里混入真正的代码非常棒——比如为特定页面做特殊布局或定制表格都很容易。扩展标记本身也很强大,我加了 Tufte 风格的边注支持。它用 X 表达式表示文本非常直观,用 Lisp 来做这件事确实比 Python 更合适,因为这种建模与 Lisp 天然契合。
lawn查看英文原文
I'm actually using pollen to create my online book[1] and it's been very good. While I write my blog in markdown it's super nice to be able to mix real code with in your markup language. For example if you want to create a special layout for a specific page or if you want a table with subtly different properties than the rest, it's easy. It's also very powerful to extend the markup itself. I added support for Tufte style sidenotes[2] which I use extensively throughout the book. This is the markup for the sidenotes: Lisp is a pretty nice◊sn{cult} language. ◊ndef["cult"]{ Some may say it's the language to rule them all. } The way it uses X-expressions to represent text is really intuitive and easy to work with. I do think there's merit to do this in lisp instead of say Python, because the modeling maps so well to lisp. [1]: https://whycryptocurrencies.com/ [2]: https://www.jonashietala.se/blog/2019/03/04/pollen_sidenotes/
质疑:对真正的作者而言,写作难点不在排版,编程化出版并非刚需
虽然看起来很厉害,但“编程一本书”对作者来说还是太难了。作者最大的困难是写作瓶颈、构思故事、为非虚构收集素材,而不是重复的语法和排版格式;这些辛苦活完成后,优秀的作者多半会把排版部分交给编辑。这些文档显然是面向对 MB 思路感兴趣的程序员,而非普通作者的真实生活。
ztratar查看英文原文
While this looks impressive, I think "programming a book" is still too tricky for authors. Repeating syntax and formatting books is hard, but authors struggle the most with writers block, creating stories, sourcing content for nonfiction, etc. Once much of this hard work is done, a lot of the good ones will partially hand off formatting to an editor/publisher. Of course they'll work closely with them, but whether that work is done in MS Word vs a Programming language is the secondary. The majority of these docs are clearly aimed at programmers who are interested in MB's though process and why the data model is clean, as opposed to what life of an average author (or best-selling author) looks like, and how the tools will help them write better books. Wishing the best for this project. Perhaps a version of it could be sold to publishers?
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com