CanvasNative v1.1.0 CanvasNative.V0.CodeType

A code line in a v0 canvas native document.

iex> source = wrap(type_name <> "-ruby") <> "class Foo"
iex> CodeType.match_native(source)
%CodeType{content: "class Foo",
          source: wrap(type_name <> "-ruby") <> "class Foo",
          type: type_name, language: "ruby"}

Summary

Functions

Format a line as a JSON object

Match a native string against @native_pattern, returning a struct or nil

Name for this type

Types

t :: %CanvasNative.V0.CodeType{content: String.t, language: String.t, source: String.t, type: String.t}

Functions

after_match_native(map)

Specs

after_match_native(%{source: String.t, type: String.t}) :: map
as_json(struct)

Specs

as_json(t) :: map

Format a line as a JSON object.

match_markdown(markdown, ctx \\ %{has_title: false, in_code: false, last_line_blank: false})

Specs

Match a Markdown string and return a struct or nil.

match_native(native)

Specs

match_native(String.t) :: t | nil

Match a native string against @native_pattern, returning a struct or nil.

new(map)

Specs

new(map) :: t
type_name()

Specs

type_name :: String.t

Name for this type.