Skip to content

Commit

Permalink
Add opts to heex/lv examples
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Oct 14, 2024
1 parent b263c94 commit 2ea47f6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
15 changes: 14 additions & 1 deletion examples/heex.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ defmodule MDEx.HEEx do

def to_html!(markdown, assigns \\ %{}) do
opts = [
render: [unsafe_: true]
extension: [
strikethrough: true,
tagfilter: true,
table: true,
tasklist: true,
footnotes: true,
shortcodes: true
],
parse: [
relaxed_tasklist_matching: true
],
render: [
unsafe_: true
]
]

markdown
Expand Down
21 changes: 19 additions & 2 deletions examples/live_view.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,27 @@ defmodule MDEx.LiveView do
raise "~M requires a variable named \"assigns\" to exist and be set to a map"
end

# manipulate MDEx options here
opts = [
extension: [
strikethrough: true,
tagfilter: true,
table: true,
tasklist: true,
footnotes: true,
shortcodes: true
],
parse: [
relaxed_tasklist_matching: true
],
render: [
unsafe_: true
]
]

md =
expr
# manipulate MDEx options here
|> MDEx.to_html!()
|> MDEx.to_html!(opts)
|> MDEx.LiveView.unescape()
|> IO.iodata_to_binary()

Expand Down

0 comments on commit 2ea47f6

Please sign in to comment.