Skip to content

Commit 0e1a849

Browse files
Add conversion support for <q> tags (#217)
1 parent e29de4e commit 0e1a849

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

markdownify/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ def convert_pre(self, el, text, parent_tags):
650650

651651
return '\n\n```%s\n%s\n```\n\n' % (code_language, text)
652652

653+
def convert_q(self, el, text, parent_tags):
654+
return '"' + text + '"'
655+
653656
def convert_script(self, el, text, parent_tags):
654657
return ''
655658

tests/test_conversions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ def test_pre():
305305
assert md("<p>foo</p>\n<pre>bar</pre>\n</p>baz</p>", sub_symbol="^") == "\n\nfoo\n\n```\nbar\n```\n\nbaz"
306306

307307

308+
def test_q():
309+
assert md('foo <q>quote</q> bar') == 'foo "quote" bar'
310+
assert md('foo <q cite="https://example.com">quote</q> bar') == 'foo "quote" bar'
311+
312+
308313
def test_script():
309314
assert md('foo <script>var foo=42;</script> bar') == 'foo bar'
310315

0 commit comments

Comments
 (0)