kartiksabharwal7
2021-5-15 11:43:59

Hi. It seems Pandoc doesn’t highlight Racket syntax. I also couldn’t find a KDE syntax highlighting XML relevant to Racket at https://github.com/KDE/syntax-highlighting. Trying to remedy this, I spent the past few hours tweaking Pandoc’s Scheme highlighter to color a subset of (Typed) Racket forms in the same style as Emacs’ Racket Mode. Before I spend time penning down highlighting rules for more Racket forms, I would like to know more about the prevailing way of publishing Racket code. Can I use Scribble to process my Pandoc-flavored-Markdown, turn all Racket blocks to HTML, and then convert the rest of the markdown file to HTML using Pandoc? Am I oblivious to an even simpler solution e.g. “just use Scribble”?


joel
2021-5-15 13:53:30

What’s your use case? Is this for blog posts, standalone documentation, other?


kartiksabharwal7
2021-5-15 13:56:07

Personal note-taking.


joel
2021-5-15 14:03:33

Ok! I would hesitate to use Scribble for that purpose. I know pygments supports Racket highlighting. There may be a way to use that with pandoc. If you want more control I would look into using Pollen, which is syntactically like Scribble but more “lightweight” (easier to customize) Here’s some info on using pygments with Pollen: https://docs.racket-lang.org/pollen/mini-tutorial.html?q=Pollen#%28part._pygments-with-pollen%29\|https://docs.racket-lang.org/pollen/mini-tutorial.html?q=Pollen#%28part._pygments-with-pollen%29


kartiksabharwal7
2021-5-15 14:04:51

I’ll look into it. Thank you!


joel
2021-5-15 14:05:25

I also wrote up a mini tutorial on how to generate automatic links for racket code within Pollen, just like Scribble does: https://thelocalyarn.com/excursus/pollen-cookbook/doclinks.html\|https://thelocalyarn.com/excursus/pollen-cookbook/doclinks.html


joel
2021-5-15 14:07:49

If I recall correctly, I think what Matthew Butterick has done in at least one Pollen project is run code through pygments and then look at the result, applying the racket doc link generator to anything pygments marked as a function or what have you.


joel
2021-5-15 14:13:54

Pollen is great if you like building designing your own markup and HTML/CSS from scratch. But for note taking with minimal setup you might want to stick with pandoc.


spdegabrielle
2021-5-15 14:25:22

@joel I was about to suggest Scribble as it is included with racket and happily generates html, pdf, .md - why do you hesitate? e.g. https://github.com/racket/scribble/blob/master/scribble-doc/scribblings/scribble/manual.scrbl\|https://github.com/racket/scribble/blob/master/scribble-doc/scribblings/scribble/manual.scrbl


joel
2021-5-15 14:44:45

It’s probably just me, but I think of Scribble like typesetting a finished book. For quick note taking with a few conveniences, or if I wanted to customize the styling at all I would reach for a less elaborate tool. Again, just personal taste.


hazel
2021-5-15 16:00:22

I wouldn’t typeset notes in Scribble for the same reason that I find it weird when people take notes in LaTeX


hazel
2021-5-15 16:00:49

(although the real best note-taking tool is pen and paper, in my opinion)


cris2000.espinoza677
2021-5-15 17:09:37

someone actually implemented the improvement I suggested for the documentation, the one where the left panel scrolls independently from the page, wild… and thank you!


cris2000.espinoza677
2021-5-15 18:24:57

can someone explain me why this doesn’t do what I expect it to do? https://gist.github.com/kurinoku/89fce7fcbf5da1f3baecf67beb3e90c6 wouldn’t this just get as many non blank/whitespace characters after a http string and return them?


laurent.orseau
2021-5-15 19:02:42

Can you give the link?


laurent.orseau
2021-5-15 19:04:19

I didn’t look deep, but it seems to me that a regexp would be more fitting to this task


cris2000.espinoza677
2021-5-15 19:05:33

yes, maybe I should have just gone with regexp, I don’t even know exactly why I didn’t


laurent.orseau
2021-5-15 19:07:26

When you want to draft equations, nothing i know of beats latex, apart sometimes from pencil and paper/e-ink. I wish i could write them in scribble


cris2000.espinoza677
2021-5-15 19:07:43

I still would like to know why it doesn’t work though.


sorawee
2021-5-15 19:07:53

I mean, lexer is regexp


cris2000.espinoza677
2021-5-15 19:08:37

yeah, but I dont get why it backtracks to the title option if there’s a space after the “url”


sorawee
2021-5-15 19:09:00

I don’t think this is a bug. It’s just not producing what you want


cris2000.espinoza677
2021-5-15 19:09:22

yeah, I don’t think it’s a bug either, I just want to understand


sorawee
2021-5-15 19:09:47

Try

[(:& (:: (:~ blank whitespace) (:* (:~ #\newline))) (complement (:: "http" any-string))) `(title ,lexeme)]


sorawee
2021-5-15 19:10:26

This will make the title refuse to match strings that start with http


sorawee
2021-5-15 19:10:56

So the only possible choice for it is url


cris2000.espinoza677
2021-5-15 19:12:01

well, that works, thanks. still weird, I would think that url takes priority here


cris2000.espinoza677
2021-5-15 19:14:12

cris2000.espinoza677
2021-5-15 19:14:44

maybe someone else asked the same, I just meant that I was surprised to see it being implemented


sorawee
2021-5-15 19:16:52

From the documentation:

> When multiple patterns match, a lexer will choose the longest match, breaking ties in favor of the rule appearing first.


cris2000.espinoza677
2021-5-15 19:17:27

ah… I should be read more carefully, thanks!


sorawee
2021-5-15 19:17:33

In your original code, both:

<https://abc.com>

and

<https://abc.com> e

can be matched, so it chooses the latter



greg
2021-5-15 19:52:32

I mean if you’re already using Emacs, there is also org-mode. It is a non-awful way to take notes; some people really like it. You can use source blocks tagged with a major mode, and it will highlight the block using that mode.


greg
2021-5-15 19:53:59

To be clear I’m not evangelizing (&lt; (or scribble pollen x) org-mode)! :smile: Just pointing out it’s another option.


joel
2021-5-15 20:02:31

Not sure if I ought to bring it up, but there’s also the not-often-discussed case against syntax highlighting, which is that it interferes with, or at least does nothing for, code legibility


cris2000.espinoza677
2021-5-15 20:08:26

now it makes a ton of sense, I was rusty so that’s why I didn’t remember that I actually already encountered similar problems with regex before.


hazel
2021-5-15 20:50:20

right, after using LaTeX for a while, I gained the ability to almost think equations in it rather than just transliterating pen-and-paper work @laurent.orseau


hazel
2021-5-15 20:50:36

I still think that paper is better for when you need to do it fast though (read: lectures)


shu--hung
2021-5-15 21:07:08

https://github.com/racket/scribble/pull/297 I think wilbowma discussed with a student and created this PR


philip.mcgrath
2021-5-15 22:26:58

Hmm, I’ve tried this again, but I’m still not getting anything in bin. I thought config-tethered-gui-bin-dir might be the answer—I hadn’t set that at first, thinking it would get a default value—but that didn’t help, either. I’m trying this on Kubuntu, if that matters. I’ve attached my config.rktd: I have a Unix-style minimal Racket installation built (by Guix) from the source download under the prefix /gnu/store/7vy0ikhd3ws5v6jydzx7aipvs4jv7rb9-racket-minimal-8.1/, and I’m working under the prefix /home/philip/code/tmp/racket-config-tethered/, with the package sources for a full Racket installation unpacked into the paths named by pkgs-dir and links-file (in the layout of a Unix-style install).


hazel
2021-5-16 00:30:03

what is the time complexity of vector-append?


samth
2021-5-16 00:39:46

O(n+m)