Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/nbconvert/exporters/markdown.py: 61%

23 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-03 06:10 +0000

1"""Markdown Exporter class""" 

2 

3# Copyright (c) Jupyter Development Team. 

4# Distributed under the terms of the Modified BSD License. 

5 

6from traitlets import default 

7from traitlets.config import Config 

8 

9from .templateexporter import TemplateExporter 

10 

11 

12class MarkdownExporter(TemplateExporter): 

13 """ 

14 Exports to a markdown document (.md) 

15 """ 

16 

17 export_from_notebook = "Markdown" 

18 

19 @default("file_extension") 

20 def _file_extension_default(self): 

21 return ".md" 

22 

23 @default("template_name") 

24 def _template_name_default(self): 

25 return "markdown" 

26 

27 output_mimetype = "text/markdown" 

28 

29 @default("raw_mimetypes") 

30 def _raw_mimetypes_default(self): 

31 return ["text/markdown", "text/html", ""] 

32 

33 @property 

34 def default_config(self): 

35 c = Config( 

36 { 

37 "ExtractAttachmentsPreprocessor": {"enabled": True}, 

38 "ExtractOutputPreprocessor": {"enabled": True}, 

39 "NbConvertBase": { 

40 "display_data_priority": [ 

41 "text/html", 

42 "text/markdown", 

43 "image/svg+xml", 

44 "text/latex", 

45 "image/png", 

46 "image/jpeg", 

47 "text/plain", 

48 ] 

49 }, 

50 "HighlightMagicsPreprocessor": {"enabled": True}, 

51 } 

52 ) 

53 if super().default_config: 

54 c2 = super().default_config.copy() 

55 c2.merge(c) 

56 c = c2 

57 return c