sirthias / pegdown

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions
http://pegdown.org
Apache License 2.0
1.29k stars 218 forks source link

PegDownProcessor's int and long constructor overloads are confusing #225

Open hayohayo opened 8 years ago

hayohayo commented 8 years ago

I think, it's a little bit inconvenient that PegDownProcessor(int options) and PegDownProcessor(long maxParsingTimeInMillis) constructors seem so similar, but have very different semantic.

I have tried to use pegdown from Clojure:

;; This one correctly enables fenced blocks
(let [pegdown (PegDownProcessor. Extensions/FENCED_CODE_BLOCKS)]
  ;; use pegdown here
  )

;; This one does not. Both bit-or and + return Long value.
;; Normally Long would be coerced to int, if maxParsingTimeInMillis
;; constructor did not exist
(let [pegdown (PegDownProcessor. (bit-or Extensions/FENCED_CODE_BLOCKS Extensions/TABLES))]
  ;; use pegdown here
  )