Replacing "#" with "@" as the directive-start character.

In the excitement of getting something working and polished, I
overlooked the fact that "#" is indeed part of Markdown syntax, and that
there is little to distinguish `;; #Directive` from `;; # Title`.

"@" is visually distinctive, and is not currently part of Markdown.
This commit is contained in:
Ben Bader 2014-02-16 15:57:54 -08:00
parent 7e1eee7ff7
commit 28eff57a69

View file

@ -50,14 +50,14 @@
(def directives (def directives
"Marginalia can be given directives in comments. A directive is a comment "Marginalia can be given directives in comments. A directive is a comment
line containing a directive name, in the form `;; #DirectiveName`. line containing a directive name, in the form `;; @DirectiveName`.
Directives change the behavior of the parser within the files that contain Directives change the behavior of the parser within the files that contain
them. them.
The following directives are defined: The following directives are defined:
* `#MargDisable` suppresses subsequent comments from the docs * `@MargDisable` suppresses subsequent comments from the docs
* `#MargEnable` includes subsequent comments in the docs" * `@MargEnable` includes subsequent comments in the docs"
{"MargDisable" (fn [] (swap! *comments-enabled* (constantly false))) {"MargDisable" (fn [] (swap! *comments-enabled* (constantly false)))
"MargEnable" (fn [] (swap! *comments-enabled* (constantly true)))}) "MargEnable" (fn [] (swap! *comments-enabled* (constantly true)))})
@ -66,7 +66,7 @@
indicating whether the line should be included in the comments indicating whether the line should be included in the comments
list." list."
[line] [line]
(let [directive (->> (re-find #"^;+\s*#(\w+)" line) (let [directive (->> (re-find #"^;+\s*@(\w+)" line)
(last) (last)
(get directives))] (get directives))]
(when directive (when directive