Skip to content

Commit

Permalink
chore: document section break
Browse files Browse the repository at this point in the history
  • Loading branch information
kptdobe authored Mar 14, 2023
1 parent 8a2c294 commit 2995a61
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion importer-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,39 @@ This is an example.
#### Special Note for `blockquote`
While exporting HTML contents enclosed within [blockquote](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) to Word docs, the `table` may not get exported correctly (like reported in https://github.com/adobe/helix-importer/issues/29). For such situations, consider removing or replacing `blockquote` enclosing the `table`.

### Add a section break

If you want to add a section break (the 3 dashes in Word `---`) to create a new section, just insert a `<hr>` element:

Example

Input DOM:

```html
<html>
<head></head>
<body>
<main>
<h1>Hello World</h1>
<p>First section</p>
<p>Second section</p>
</main>
</body>
</html>
```

```js
const firstParagraph = document.querySelector('main p')
firstParagraph.after(document.createElement('hr'));
```

```md
# Hello World
First section
---
Second section
```

### Convert background images

Backgroud images are either part of the CSS or inline styles. As mentioned above, the styles considered when converting the DOM to Markdown. If background images are used on the pages being imported, they must receive a special treatment.
Expand Down Expand Up @@ -653,4 +686,4 @@ In the `import.js` file, you can define the `onLoad` function: it will be called
The code above forces the import process to wait for the DOM element with CSS class name `wait-for-me`. It checks every 500s if the element is there and fires an error if not found after 10s.
Firing an error is one way of defining the page has a problem (maybe it is different ?). The error message will appear in the report and can be reviewed afterward. But it is not required. If it is fine for the page to not have the element, you can just log an error or do nothing.

Note: calling `WebImporter.Loader.waitForElement` in the `transformDOM` or `transform` function would be useless - the execution context is different, the DOM is frozen and does not change anymore.
Note: calling `WebImporter.Loader.waitForElement` in the `transformDOM` or `transform` function would be useless - the execution context is different, the DOM is frozen and does not change anymore.

0 comments on commit 2995a61

Please sign in to comment.