Skip to content

Commit

Permalink
Ignore frontmatter when viewing markdown documents
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
davep committed Mar 26, 2024
1 parent cd22d05 commit 53784d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Frogmouth ChangeLog

## Unreleased

### Added

- Front matter is now ignored when viewing a file.
[#15](https://github.com/Textualize/frogmouth/issues/15)

## [0.9.2] - 2023-11-28

Expand Down
9 changes: 8 additions & 1 deletion frogmouth/widgets/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from webbrowser import open as open_url

from httpx import URL, AsyncClient, HTTPStatusError, RequestError
from markdown_it import MarkdownIt
from mdit_py_plugins import front_matter
from textual import work
from textual.app import ComposeResult
from textual.binding import Binding
Expand Down Expand Up @@ -142,7 +144,12 @@ class HistoryUpdated(ViewerMessage):

def compose(self) -> ComposeResult:
"""Compose the markdown viewer."""
yield Markdown(PLACEHOLDER)
yield Markdown(
PLACEHOLDER,
parser_factory=lambda: MarkdownIt("gfm-like").use(
front_matter.front_matter_plugin
),
)

@property
def document(self) -> Markdown:
Expand Down

0 comments on commit 53784d5

Please sign in to comment.