Skip to content

Commit

Permalink
add alert, emoji, quote, others; fix code, nameOf
Browse files Browse the repository at this point in the history
  • Loading branch information
halotukozak committed Apr 7, 2024
1 parent 8c23762 commit cd617ce
Show file tree
Hide file tree
Showing 15 changed files with 2,056 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/Markdown.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package halotukozak.smark

def markdown(input: String*): String = input.mkString("\n")
def markdown(input: String*): String = input.mkString("\n\n")
9 changes: 9 additions & 0 deletions src/main/scala/typography/Alert.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package halotukozak.smark
package typography

type Alert
type Note <: Alert
type Tip <: Alert
type Important <: Alert
type Warning <: Alert
type Caution <: Alert
9 changes: 4 additions & 5 deletions src/main/scala/typography/Code.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package halotukozak.smark
package typography

import typography.macros.text
import typography.macros.{codeUnsafe, text}
import utils.nameOf

type code <: String
Expand All @@ -11,9 +11,9 @@ type java <: code
type kotlin <: code
type sql <: code
type bash <: code
type html <: code

inline def code[L <: code](inline code: L): String = nameOf[L] + text[BlockCode](code)
inline def codeUnsafe(language: String, code: String): String = language + text[BlockCode](code)
inline def code[L <: code](inline code: L): String = codeUnsafe(nameOf[L], code)

implicit class ScalaHelper(private val sc: StringContext) extends AnyVal {
def scala(args: Any*): scala = sc.s(args *).asInstanceOf[scala]
Expand All @@ -28,6 +28,5 @@ implicit class ScalaHelper(private val sc: StringContext) extends AnyVal {

def bash(args: Any*): bash = sc.s(args *).asInstanceOf[bash]


def html(args: Any*): String = "\n" + sc.s(args *) + "\n"
def html(args: Any*): html = sc.s(args *).asInstanceOf[html]
}
Loading

0 comments on commit cd617ce

Please sign in to comment.