Skip to content

CitationStyleLinks, OmitTableNodes options#32

Closed
adtac wants to merge 3 commits intojaytaylor:masterfrom
adtac:adtac/mr1
Closed

CitationStyleLinks, OmitTableNodes options#32
adtac wants to merge 3 commits intojaytaylor:masterfrom
adtac:adtac/mr1

Conversation

@adtac
Copy link

@adtac adtac commented Feb 17, 2019

Citation Style Links

Example:

Here is a <a href="http://example.com/">link</a> to some page and <a href="http://google.com">another link</a> too

Output:

Here is a link [1] to some page and another link [2] too

[1] http://example.com
[2] http://google.com

Omit Table Nodes

Just like the OmitLinks option, but for tables. Inserts a "[Table]" text in the place of the table.

@adtac adtac changed the title html2text.go: add citation style links CitationStyleLinks, OmitTableNodes options Feb 17, 2019
@jaytaylor
Copy link
Owner

Hi @adtac,

Thank you for your contribution. Before it can be merged, please consider the following feedback:

  1. I like the citation-style links option.

  2. Can editor-specific files please not be committed into the repository? Lots of editors don't recognize .editorconfig.

  3. What is the purpose of the [Table] annotation?

Thank you!
Jay

@adtac
Copy link
Author

adtac commented Mar 10, 2019

.editorconfig is specifically to prevent editor-specific files :) It's a widely accepted standard that lots of people use and prefer, but if you prefer to not have them, I'll remove it.

What is the purpose of the [Table] annotation?

Just to have some context that there's a table there in the html version. To make sure they know it's there. Usually, tables follow some normal text with references to the table, so it might be confusing to the reader if there's a reference to a table that can't be found.

Thanks for the feedback, I'll amend my commits and re-push soon.

@jaytaylor
Copy link
Owner

Thanks for explaining.

Two additional things, once resolved I'll gladly merge:

  1. Are you okay with renaming "OmitTableNodes" to "OmitTables"?

  2. It looks like there was a test failure related to citation-style links where the numbers ended up reversed:

https://travis-ci.org/jaytaylor/html2text/jobs/494601746#L509-L519

Will you please look into how this is possible and resolve it?

@jaytaylor
Copy link
Owner

One more small change: Change the comment for OmitTables to:

// Skip rendering of table contents, and "[Table]" will be inserted instead.

@jaytaylor
Copy link
Owner

One idea which would be cool (and is certainly not necessary for this PR) would be to make the skipping dynamic and allow an array of HTML element types to be passed for which rendering would be skipped or have [$tag] inserted instead of rendering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants