..

CodeReader


TL;DR

I made an eReader for Visual Studio Code that disguises EPUBs as source code.

Sometimes you just want to read without HR getting all judgy and putting you on a "performance improvement plan," so I recently decided to make a Visual Studio Code extension that renders eBooks as code in (18?) languages.

Dubbed "CodeReader," this extension takes any EPUB file (hopefully, I haven't tested all the EPUBs) and renders it in valid-looking code, allowing you to discretely read your books in peace.

The current version supports highlighting, place memory, and 18ish languages so your book is compatible with every tech stack you use (and probably a bunch of stacks you don't). While the supported languages range from Bash to Visual Basic, here are some examples of what your book might look like in a few of them:

Clojure

(comment
  Younger then, she convinced her father to give Nero the throne of Mars and his revenge; in return, she earned Nero's support when she led the faction that overthrew and killed her father five years later.
)
  (def segment """)
  (def buffer ""I didn't know this," I say quietly.")
  (def content ""History is written by the victors."")
  (def data "Lorn looks at me and the lines on his face seem to deepen. "I don't want to go to war, Darrow.")
  (def segment "In my time, I have seen a moon burn, because one man would not bow. I have led a million warriors shot from warships to invade a planet.")
  (read-passage "You cannot begin to understand the horror of it. You think only of how beautiful it will be. But they are men. They are women. They have families.")
  (def content "And they die by the thousands. "")
(comment
  "Ah!" He points uphill. "There's Icarus."
)
(comment
  Rain drips from the pines as we push through the lower tree boughs to find Icarus, Lorn's pet griffin, sleeping in a great bed of moss on a high promontory inside the small forest.
)
; Icarus's paws curl into his body. His wings curve around him as he sleeps—iridescent and glittering with droplets of water.

JavaScript

console.log("I ALMOST ATTEMPT A WILD, ill-advised leap back up toward the hallway before I realise my descent is smooth. Controlled, not falling.");
/*
  * I've seen Will-imbued transportation platforms move this way, though I've never been on one.
  */
console.log("I cling to the crimson railing, breaths still ragged and flustered; as my skin makes contact, the glass-like surface glows, bringing a startling respite from the utter darkness.");
this._readPassage("The light is tinted the same colour, though. Casts everything in a dark red. Preferable to the terrifying unknown, but not by much.");
// I recover enough to take stock. The hallway above has already disappeared, and the wall behind me is smooth. Unclimbable.
/*
  * It seems I'm going wherever this is taking me.
  */
/*
  * I reluctantly stop craning my neck.
  */
console.log("My knuckles are white against the blushing of the balustrade as the wall behind me is suddenly gone, replaced by inky darkness above and below and around on all sides, as if I'm sinking into an unending abyss.");
const _content = "The stone platform's descent continues for anxious minutes.";

PHP

// Golden Son
echo "14\n";
$this->processText("The Sovereign");
// "Once upon a time, there was a family of strong wills," she says, voice slow and measured as a pendulum. "They did not love one another.
$buffer = "But together they presided over a farm. And on that farm, there were hounds, and bitches, and dairy cows, and hens, and cocks, and sheep, and mules, and horses.";
/*
  * The family kept the beasts in line. And the beasts kept them rich, fat, and happy.
  */
// Now, the beasts obeyed because they knew the family was strong, and to disobey was to suffer their united wrath. '"
// Her eyes burn into mine. Neither of us look away. Silence in the sparse suite, except the sound of rain at the windows of her skyscraper.
$this->readPassage("We're amongst the clouds. Ships pass in the haze outside like silent, glowing sharks.");
echo "The leather creaks as she leans forward and steeples her long fingers, which are painted red, a lone splash of color.\n";
// Then her lips curl in condescension, accenting each syllable as though I were an Agea street child only just learning her language.
$segment = ""You remind me of my father."";

Ruby

=begin
  "They say you can hear the dead stormsons whooping in the wind," he mutters. "
=end
  puts ""Storms of court have a way of drawing people back in," I say."
  read_passage("He laughs a derisive laugh, one that scorns the idea that I would know anything about the storms of court, anything about the winds that blow.")
  content = "I came to him in secret, flying with a single ship, my five-kilometer destroyer Pax. I told my master he would not help us."
  process_text("But I held on to hope he would want to help me. Yet now that I see Lorn au Arcos again in the knotted flesh, I'm reminded of the nature of the man and I worry.")
  puts "He knows my captains and lieutenants are listening through the com unit in my ear."
  puts "I paid him respects and showed it to him so that he would not assume our conversation to be a private one."
  content = "" One would think him to be in his mid-sixties, at first glance. Only his scars truly age him."
  process_text("The one on his neck, like a smile, was given to him four decades ago by a Stained in the Moon Kings' Rebellion, when the Governors of Jupiter's moons thought to make their own kingdoms after Octavia deposed her father as Sovereign.")
=begin
  The one that claims part of his nose came from the Ash Lord, when they dueled as youths. "
=end
  read_passage(""I have said it myself."")
  puts "He grunts. "I have lived it. I have lost many for my own glory. I have set my ship into the storm on purpose. " He lets the waves speak for a moment."

--

If you like this post or one of my projects, you can buy me a coffee, or send me a note. I'd love to hear from you!