We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e98c94 commit 72a66b2Copy full SHA for 72a66b2
1 file changed
Types/OpenXML.Word.Heading/get_Markdown.ps1
@@ -0,0 +1,38 @@
1
+$runs = @($this.r)
2
+$headingLevel = 1
3
+if ($this.pPr.pStyle -match '\d') {
4
+ $headingLevel = $matches.0 -as [int]
5
+}
6
+
7
+('#' * ($headingLevel)) +
8
+ ' ' +
9
+ $(@(foreach ($run in $runs) {
10
11
+ $runText = $run.t
12
+ if ($runText -isnot [string]) {
13
+ $runText = $run.t.InnerText
14
+ }
15
16
+ if (-not $run.rPr.psobject.properties) {
17
+ $runText
18
19
+ elseif ($run.rPr.psobject.properties['b'] -and
20
+ $run.rPr.psobject.properties['i']
21
+ ) {
22
+ "***$runText***"
23
24
+ elseif (
25
+ $run.rPr.psobject.properties['b']
26
27
+ "**$runText**"
28
29
30
31
32
+ "*$runText*"
33
+ } else {
34
35
36
37
38
+) -join '' -replace '(?<=\w)(?>\*{6}|\*{4})(?=\w)')
0 commit comments