aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-25 19:30:05 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-25 19:30:05 +0000
commit7cd4b9bee08edccc753f15d0489e7fcc8c416991 (patch)
treef4171288ceb8f000a5692642a2a998cf48544ce7
parent137f9e20d36df58590dedad6f0ab885ed435e2dd (diff)
Document bold and italic document matchers
-rw-r--r--NEWS4
-rw-r--r--README.md56
2 files changed, 60 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index c7b0b27..c10d83e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+# 0.3.32
+
+* Allow bold and italic style mappings to be configured.
+
# 0.3.31
* Handle references to missing styles when reading documents.
diff --git a/README.md b/README.md
index 1f7d44f..ee415a3 100644
--- a/README.md
+++ b/README.md
@@ -218,6 +218,40 @@ var options = {
};
```
+#### Bold
+
+By default, bold text is wrapped in `<strong>` tags.
+This behaviour can be changed by adding a style mapping for `b`.
+For instance, to wrap bold text in `<em>` tags:
+
+```javascript
+var mammoth = require("mammoth");
+
+var options = {
+ styleMap: [
+ "b => em"
+ ]
+};
+mammoth.convertToHtml({path: "path/to/document.docx"}, options);
+```
+
+#### Italic
+
+By default, italic text is wrapped in `<em>` tags.
+This behaviour can be changed by adding a style mapping for `i`.
+For instance, to wrap italic text in `<strong>` tags:
+
+```javascript
+var mammoth = require("mammoth");
+
+var options = {
+ styleMap: [
+ "i => strong"
+ ]
+};
+mammoth.convertToHtml({path: "path/to/document.docx"}, options);
+```
+
#### Underline
By default, the underlining of any text is ignored since underlining can be confused with links in HTML documents.
@@ -525,6 +559,28 @@ For instance, to match a paragraph with the style ID `Heading1`:
p.Heading1
```
+#### Bold
+
+Match explicitly bold text:
+
+```
+b
+```
+
+Note that this matches text that has had bold explicitly applied to it.
+It will not match any text that is bold because of its paragraph or run style.
+
+#### Italic
+
+Match explicitly italic text:
+
+```
+i
+```
+
+Note that this matches text that has had italic explicitly applied to it.
+It will not match any text that is italic because of its paragraph or run style.
+
#### Underline
Match explicitly underlined text: